今天做题突然想到了一道题,这题真的是坑,快速幂会爆炸
#include <bits/stdc++.h>
typedef long long LL;
const int maxn = 5e6 + 1;
using namespace std;
LL mod = 10000000007;
LL a[10][maxn];
void init() {
for (int i = 1; i < 10; ++i) {
a[i][0] = 1;
for (int j = 1; j < maxn; ++j) {
a[i][j] = a[i][j-1] * i % mod;
}
}
}
int main() {
ios::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
init();
int n;
string s;
LL ans = 0;
cin >> s;
n = s.size();
for (int i = 0; i < n; ++i) {
ans = (ans + a[s[i]-'0'][i]) % mod;
}
cout << ans << endl;
return 0;
}