#include <bits/stdc++.h>
using namespace std;

using ll = long long;
using lb = long double;
#define fi first
#define se second
#define pb push_back

ll times_cap(ll a, ll b) {
	if (log10(a) + log10(b) >= 17.0)return 1e17;
	else return a * b;
}

typedef pair<int64_t, int64_t> P;

int main(){
  ll x,y;
  cin>>x>>y;
  if(x>=y){
    cout<<x-y<<endl;
    return 0;
  }
  map<ll,ll> dis;
  priority_queue<P,vector<P>,greater<P>> pq;
  pq.push({0,y});
  ll ans=y-x;
  dis[x]=ans;
  ll A=1,D=1;
  while(!pq.empty()){
    auto tmp=pq.top(); pq.pop();
    ll v=tmp.second,cst=tmp.first;
    dis[x]=min(cst+abs(v-x),dis[x]);
    ans=min(dis[x],ans);
    if(cst>dis[v])continue;
    if(cst>ans)continue;
    if(v==x){
      ans=min(ans,cst);
      continue;
    }
    if(v<=x){
      ans=min(ans,cst+x-v);
      continue;
    }
    
    if(v%2==0){
      if(dis[v/2]==0||dis[v/2]>dis[v]+1){
        dis[v/2]=cst+1;
        pq.push({dis[v/2],v/2});
      }
      /*if(dis[v+1]==0||dis[v+1]>dis[v]+1){
        dis[v+1]=cst+1;
        pq.push({dis[v+1],v+1});
      }*/
      /*if(dis[v-1]==0||dis[v-1]>dis[v]+1){
        dis[v-1]=cst+1;
        pq.push({dis[v-1],v-1});
      }*/
    }
    else{
      if(dis[v+1]==0||dis[v+1]>dis[v]+1){
        dis[v+1]=cst+1;
        pq.push({dis[v+1],v+1});
      }
      if(dis[v-1]==0||dis[v-1]>dis[v]+1){
        dis[v-1]=cst+1;
        pq.push({dis[v-1],v-1});
      }
    }        
  }
  cout<<ans<<endl;
}
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main () {
  int a, b;
  cin >> a >> b;
  ll K;
  cin >> K;
  ll cmp[63][63];
  for (int i = 0; i <= 60; i ++) {
    cmp[i][0] = cmp[i][i] = 1;
    for (int j = 1; j < i; j ++) {
      cmp[i][j] = cmp[i - 1][j] + cmp[i - 1][j - 1];
    }
  }
  int s = a + b;
  for (int i = 0; i < s; i ++) {
    if (a == 0) {
      cout << 'b';
      b --;
    } else if (b == 0) {
      cout << 'a';
      a --;
    } else {
      if (K <= cmp[a + b - 1][a - 1]) {
        cout << 'a';
        a --;
      } else {
        cout << 'b';
        K -= cmp[a + b - 1][a - 1];
        b --;
      }
    }
  }
  cout << endl;
}