#include <bits/stdc++.h>
using namespace std;
const int N=20;
int a,b,idx;
int shu[N];
long long n,maxx;
inline int read(){
int t=0,f=1;
register char c=getchar();
while (c<48||c>57) f=(c=='-')?(-1):(f),c=getchar();
while (c>=48&&c<=57)t=(t<<1)+(t<<3)+(c^48),c=getchar();
return f*t;
}
void dfs(int ceng,int one,int two){
if(ceng==0){
n=0;
for(int i=idx;i>=1;i--){
n=n*10+shu[i];
}
maxx=max(maxx,n);
return;
}
int ha=9-shu[ceng],hb=shu[ceng]+1,dang=shu[ceng];
if(ha<=one&&hb<=two){
shu[ceng]=9;
dfs(ceng-1,one-ha,two);
dfs(ceng-1,one,two-hb);
}else if(ha<=one){
shu[ceng]=9;
dfs(ceng-1,one-ha,two);
}else if(hb<=two){
shu[ceng]=9;
dfs(ceng-1,one,two-hb);
}else{
shu[ceng]+=one;
dfs(ceng-1,0,two);
}
shu[ceng]=dang;
}
int main(){
n=read(),a=read(),b=read();
while(n){
shu[++idx]=n%10;
n/=10;
}
dfs(idx,a,b);
cout<<maxx;
return 0;
}