#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cstring>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <bitset>
  
#define rep(i, n) for(int i = 0; i < (n); i++)
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define all(v) (v).begin(), (v).end()
#define rev(s) (s).rbegin(), (s).rend()
#define MP make_pair
#define X first
#define Y second
  
using namespace std;
  
typedef long long ll;
typedef pair<int, int> P;

const int INF = 1<<29;

string A, B;
int dfs(int borrow, int K, int i){
	if(i == A.size()) return 0;
	int bi = (borrow>>i)&1;
	int res = 0;
	if(K > 0 && bi){
		res = dfs(borrow&(~(1<<i)), K-1, i);
	}
	int C = 0;
	if(A[i] - bi >= B[i]){
		C = (A[i] - bi - B[i]);
	}else{
		C = (A[i] - bi + 10 - B[i]);
		borrow |= (1<<i+1);
	}
	return max(res, C + 10*dfs(borrow, K, i+1));
}

int main(){
	int K;
	cin >> A >> B >> K;

	reverse(all(A));
	reverse(all(B));

	while(B.size() < A.size()) B += '0';

	cout << dfs(0, K, 0) << endl;

    return 0;
}