#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
string ANS="0000000000";

void cal(string A,string B,int C,int D){
	if(A.size()==D+1){
		string st="";
		for(int i=0;i<A.size();i++)st+=(A[i]-B[i]+'0');
		reverse(st.begin(),st.end());
		if(ANS<st)ANS=st;
	}
	else{
		if(A[D]>=B[D]){
			cal(A,B,C,D+1);
		}
		else{
			A[D]+=10;
			string AA=A;
			A[D+1]--;
			cal(A,B,C,D+1);
			if(C>0){
				cal(AA,B,C-1,D+1);
			}
			
		}
	}
}


int main(){
	string a,b;
	int c;
	cin>>a>>b>>c;
	reverse(a.begin(),a.end());
	reverse(b.begin(),b.end());
	while(a.size()<10)a+="0";
	while(a.size()>b.size())b+="0";
	cal(a,b,c,0);
	
	for(int i=0,j=0;i<ANS.size();i++){
		if(j==0&&ANS[i]!='0')j=1;
		if(j)cout<<ANS[i];
	}
	cout<<endl;
	
	return 0;
}
