#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
const int N = 1e6 + 10;
int t, n, m, k, l, r, op, x, y, ans;
int f[N];
void solve() {
cin >> x >> l >> r;
while (x) {
f[m++] = x % 2;
x /= 2;
}
swap(f[l], f[r]);
for (int i = 0; i < max(m, r+1); i++) {
ans += pow(2, i)*f[i];
}
cout << ans;
}
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
solve();
return 0;
}