#include <bits/stdc++.h>

using namespace std;
using ll = long long;

int main(){
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);

    ll C, Y, s=0;
    cin >> C >> Y;
    vector<ll> a = {1, 5, 10, 50, 100, 500, 1000, 2000, 5000, 10000}, b(10);
    for (int i=9; i>=0; i--){
        b[i] = Y/a[i];
        Y %= a[i];
    }
    if (b[4] >= C){
        cout << "no exchange" << endl;
        return 0;
    }
    for (int i=5; i<10; i++){
        s += b[i]*a[i];
    }
    if (s / 100 + b[4] < C){
        cout << "can't exchange" << endl;
        return 0;
    }
    //x+5y>=C
    //y>=(C-x)/5
    cout << b[4] + (C-b[4]+4)/5*5 << endl;

    return 0;
}