#include<bits/stdc++.h>
#define LL long long
#define REP(i,n) for(int i=0;i<(n);++i)
#define lp(i,n) for(int i=0;i<(n);i++)
#define REPA(i,n) for(int i=1;i<(n);++i)
#define PII pair<int,int>
#define PLI pair<long long, int>
#define PLL pair<long long, long long>
#define MOD ((int)1e9 + 7)
#define INF ((int)2e9)
#define INFLL ((LL)1e18)
#define ALL(x) (x).begin(),(x).end()
#define CTOI(x) (x - 'A') 
#define ctoi(x) (x - 'a')
#define BIT(x) (1 << (x))
using namespace std;
int a,b,k,si,ans=-1;

void solve(int it,int bo,int kcnt,int an){
  if(it==si){
    ans=max(ans,an);
    return;
  }
  int nowa=a/pow(10,it);
  nowa%=10;
  int nowb=b/pow(10,it);
  nowb%=10;
  if(nowa-bo>=nowb){
    solve(it+1,0,kcnt,an+(nowa-bo-nowb)*pow(10,it));
  }
  else{
    if(kcnt!=k){
      solve(it+1,0,kcnt+1,an+(nowa-bo+10-nowb)*pow(10,it));
    }
    solve(it+1,1,kcnt,an+(nowa-bo+10-nowb)*pow(10,it));
  }
  return;
}

int main(){
  cin>>a>>b>>k;
  string s=to_string(a);
  si=s.size();
  solve(0,0,0,0);
  cout<<ans<<endl;
  return 0;
}

