#include<bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(n);i++)
using namespace std;

string a,b;int k;
int Max=0;
string c;
void dfs(int i,int p,int t){
	if(i==a.size()){
		string q=c;reverse(q.begin(),q.end());
		Max=max(Max,stoi(q));
		return;
	}
	if(a[i]-p>=b[i]){
		c+=to_string(a[i]-p-b[i]);
		dfs(i+1,0,t);c.pop_back();
	}
	else{
		c+=to_string(a[i]-p+10-b[i]);
		dfs(i+1,1,t);c.pop_back();
	}
	if(t){
		if(a[i]>=b[i]){
			c+=to_string(a[i]-b[i]);
			dfs(i+1,0,t-1);c.pop_back();
		}
		else{
			c+=to_string(a[i]+10-b[i]);
			dfs(i+1,1,t-1);c.pop_back();
		}
	}
}
int main(){
	cin>>a>>b>>k;
	reverse(a.begin(),a.end());
	reverse(b.begin(),b.end());
	while(a.size()>b.size())b+='0';
	for(char&c:a)c-='0';
	for(char&c:b)c-='0';
	dfs(0,0,k);
	printf("%d\n",Max);
}