#include <iostream>
#include <fstream>
#include <cmath>
using namespace std;
ifstream f("fractal.in");
ofstream g("fractal.out");
int sum;
int pow(int b, int e){
int x=1;
while(e){
x*=b;
e--;
}
return x;
}
int dimp(int k, int x, int y, int &sum){
if(k==1){
if(x==1&&y==2)
sum+=1;
if(x==2 && y==2)
sum+=2;
if(x==2&&y==1)
sum+=3;
}
else {
if(x>=pow(2,k-1)&&y>pow(2,k-1))
{
sum+=2*(pow(2,2*(k-1))-1)+2;
dimp(k-1,x-pow(2,k-1),y-pow(2,k-1), sum);
}
else if(x<=pow(2,k-1)&&y<=pow(2,k-1))
{
dimp(k-1,y,x, sum);
}
else if(x<=pow(2,k-1)&&y>=pow(2,k-1))
{
sum+=(pow(2,2*(k-1))-1)+1;
dimp(k-1,x,y-pow(2,k-1), sum);
}
else if(x>=pow(2,k-1)&&y<=pow(2,k-1))
{
sum+=3*(pow(2,2*(k-1))-1)+3;
dimp(k-1,pow(2,k-1)+1-y,pow(2,k)+1-x,sum);
}
}
}
int main()
{
int a,b,c;
f>>a>>b>>c;
dimp(a,b,c,sum);
g<<sum;
cout<<pow(2,3);
return 0;
}