C,Y=map(int,input().split()) keta=[1,5,10,50,100,500,1000,2000,5000,10000] count=[0]*10 for i in range(9,-1,-1): count[i]=Y//keta[i] Y-=keta[i]*count[i] if count[4]>=C: print('no exchange') exit(0) all=count[4] ans=0 for i in range(9,4,-1): for j in range(count[i]): all+=keta[i]//keta[4] if all>=C: print(all) exit(0) print('can\'t exchange')