#include #include using namespace std; long long A, B, power[200], nr, ans; int b[2000], i, n; int main() { cin >> A >> B; if(A>=10) { cout << 0 << '\n'; return 0; } power[0] = 1; for(i=1; i<=19; ++i) power[i] = power[i-1] * (10-A); while(B) { b[++n] = B%10; B /= 10; } for(i=1; i<=n; ++i) if(b[i] > A) ans += (b[i]-A) * power[i-1]; for(i=1; i