#include<iostream>
using namespace std;
#include<string>
#include<strstream>
#include<sstream>
#include<algorithm>
#include<math.h>
#include<iomanip>
#include<set>
long long mod = 10e18;
long long is(int n)
{
	if (n == 0)
		return 2;
	if (n == 1)
		return 1;
	return (is(n - 1) + is(n - 2));
}
int main()
{
	int n, k; cin >> n >> k; int j = 1;
	j += j;
	for (int i = 2; i <= n; ++i)
	{
		if (j < k)
		{
			j += j;
		}
		else
			j += k;
	}
	cout << j;
	
}
#include<iostream>
#include<cstdio>
#include<map>
using namespace std;
#define int long long
map<char, int> m={
        {'I',1},
        {'V',5},
        {'X',10},
        {'L',50},
        {'C',100},
        {'D',500},
        {'M',1000},
};
signed main(){
        char buf[256];
        while( scanf("%s", buf) != EOF ){
                int ans = 0;
                for(int i=0; i<256 && buf[i]!=0;i++){
                        if(buf[i+1]==0){
                                ans+=m[buf[i]];
                        }else{
                                if(m[buf[i]]<m[buf[i+1]]) ans-=m[buf[i]];
                                else ans+=m[buf[i]];
                        }
                }
                cout << ans<< endl;
        }
        return 0;
}