#include<iostream>
#include<vector>
#include<cassert>
#include<cmath>

using namespace std;

long long A,B,K;

long long calc(const string& s){

  long long a = A, b = B, c = 0, borrow = 0;
  int base = 1;
  int N = (int)log10(A)+1;

  for(int i = 0; i < N; i++){
    long long tmpA = a%10;
    long long tmpB = b%10;
    a /= 10;
    b /= 10;

    if(tmpA - borrow >= tmpB){
      c += (tmpA-borrow-tmpB)*base;
      borrow = 0;
      base*=10;
    }else{
      c += (tmpA - borrow + 10 - tmpB)*base;
      if(s[i] == '1') borrow = 0;
      else borrow = 1;
      base*=10;
    }
  }
  return c;
}

long long rec(long long k, const string& s){
  if(s.length() == ((int)log10(A)+1)) return calc(s);
  if(k) return max(rec(k-1,s+"1"),rec(k,s+"0"));
  return rec(k,s+"0");
}

int main(){
  cin >> A >> B >> K;
  cout << rec(K,"") << endl;
  return 0;
}