#include #pragma GCC optimize("Ofast") #pragma GCC optimize("unroll-loops") #define fi first #define se second #define int long long #define vec vector using namespace std; unordered_map used; unordered_map cnt; int rec(int n) { if(used[n]==1) { return cnt[n]; } bool flag = true; if(n == 1 || n == 0) { cnt[n] = 0; used[n] = 1; return 0; } for(int i = 2; i 0) { int ost1 = (n % 10)*d+ost; n/=10; int a = n*d + ost; // cout << alt<< " "<>n; int ans = rec(n); cout << ans; } signed main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int tests = 1; while(tests--) { solve(); } }