X,Y=map(int,input().split()) c=[1,5,10,50,100,500,1000,2000,5000,10000] d={v:i for i,v in enumerate(c)} a=[0]*len(c) for v in c[::-1]: a[d[v]]=(Y//v)*v Y%=v if a[d[100]]//100>=X: print("no exchange") elif sum(a[d[100]:])//100>=X: ok=0 ng=10**10 while ng-ok>1: m=(ok+ng)//2 if (a[d[100]]+sum(a[d[500]:])-500*m)//100>=X: ok=m else: ng=m print((a[d[100]]+sum(a[d[500]:])-500*ok)//100) else: print("can't exchange")