#include using namespace std; using ll = long long; template istream& operator >> (istream& is, vector& vec) { for(T& x : vec) is >> x; return is; } template ostream& operator << (ostream& os, const vector& vec) { if(vec.empty()) return os; os << vec[0]; for(auto it = vec.begin(); ++it != vec.end(); ) os << ' ' << *it; return os; } int main(){ ios::sync_with_stdio(false); cin.tie(0); ll C, X; cin >> C >> X; vector a = {1,5,10,50,100,500,1000,2000,5000,10000}; vector b(a.size()); for(int i = a.size() - 1; i >= 0; i--){ b[i] = X / a[i]; X %= a[i]; } if(b[4] >= C){ cout << "no exchange" << '\n'; return 0; } ll v = b[4]; for(int i = 5; i < a.size(); i++){ v += a[i] * b[i] / 100; } if(v < C){ cout << "can't exchange\n"; }else{ v = (C - b[4] + 499) / 500; v = v * 5 + b[4]; cout << v << '\n'; } }