#include "bits/stdc++.h"

using namespace std;

#define int long long
#define endl '\n'
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(X) (X).begin(), (X).end()
#define allr(X) (X).rbegin(), (X).rend()
#define sz(X) (int)X.size()
#define setbits(X) __builtin_popcountll(X)
#define fix(X) fixed << setprecision(X)
#define mem0(X) memset((X), 0, sizeof((X)))
#define mem1(X) memset((X), -1, sizeof((X)))

void solve() {
    int x, y;
    cin >> x >> y;
    if (x == y) {
        cout << x << endl;
        return;
    }
    if (x > y) {
        swap(x, y);
    }
    if (x + 1 == y) {
        int chk = (y + 1) % 3;
        cout << (chk == 0 ? 0 : chk) << endl;
        return;
    } else {
        cout << x + 1 << endl;
        return;
    }
}

int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    int t = 1;
//    cin >> t;
    while (t--) solve();
    return 0;
}
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

const ll DIM = 200007, maxN = 200000, INF = 10000000000007, mod = 1000000007;

ll t, n, k, a[DIM], b[207];
string s;
vector<ll> simple_numbers;
bool flag;

void solve() {
	cin >> n >> k;
	for (int i = 1; i <= k; ++i) {
		if (n % 200 == 0) n /= 200;
		else {
			n *= 1000;
			n += 200;
		}
	}
	cout << n << '\n';
}

int main() {
	cin.tie(0);
	cout.tie(0);
	ios::sync_with_stdio(false);

	//cin >> t;
	t = 1;
	while(t--)
		solve();
	return 0;
}