#include <iostream>
#include <cstdlib>
using namespace std;

string A,B;
int ans = 0;
void dfs(int p,string C,int k,int c){
	//cout << "[" << C << "]" << " " << k << " " << p << endl;
	if( p < 0 ) {
		if( c == 0 ) {
			
			ans = max( ans , atoi(C.c_str()));
		}
		
		return;
	}else{
		int carry = 0;
		int calc = (int)A[p] - (int)B[p] - (int)c; 
		if( calc >= 0 ){
			dfs(p-1,string(1,'0'+calc)+C,k,0);
		}else{
			calc = 10 + calc;
			//cout << calc << "<<" << endl;
			dfs(p-1,string(1,'0'+calc)+C,k,1);
			if(k) dfs(p-1,string(1,'0'+calc)+C,k-1,0);		
		}
	}
}
int main(){
	int K;
	cin >> A >> B>> K;
	while(B.size() < A.size() ) B = "0" + B;
	while(B.size() > A.size() ) A = "0" + A;
	dfs(A.size()-1,"",K,0);
	cout << ans << endl;
}