#include<iostream>
#include<queue>
#include<algorithm>
#define int long long
using namespace std;
const int N=2e5+9;
signed main(){
ios::sync_with_stdio(false);
cin.tie(0),cout.tie(0);
string s; cin >>s;
int a,b; cin >>a>>b;
for(int i=0;i<s.size();i++){
if(a==0&&b==0) break;
int x=s[i]-'0';
int ta=9-x,tb=x+1;
if(ta<tb){
if(a>=ta){
a-=ta;
s[i]='9';
}else{
s[i]=x+a+'0';
a=0;
}
}else{
if(b>=tb){
b-=tb;
s[i]='9';
}else{
if(a){
if(a>=ta){
a-=ta;
s[i]='9';
}else{
s[i]=x+a+'0';
a=0;
}
}
}
}
}
cout <<s;
return 0;
}