#include #include using ll = long long; using ull = unsigned long long; #define rep(i, n) for(int i = 0; i < (int)(n); i++) #define REP(i, m, n) for(int i = (int)(m); i < (int)(n); i++) using namespace std; using namespace atcoder; using mint = modint998244353; const int inf = 1000000007; const ll longinf = 1ll << 60; int main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); int c, y; cin >> c >> y; vector v = {1, 5, 10, 50, 100, 500, 1000, 2000, 5000, 10000}; vector cnt(10); for(int i = 9; i >= 0; i--) { cnt[i] = y / v[i]; y -= cnt[i] * v[i]; } if(cnt[4] >= c) { cout << "no exchange" << endl; return 0; } int ma = 0; REP(i, 4, 10) { ma += cnt[i] * v[i] / 100; } if(ma < c) { cout << "can't exchange" << endl; return 0; } cout << (ma - c) % 5 + c << endl; return 0; }