Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- #define ll long long int
- int main() {
- ios_base::sync_with_stdio(false);
- cin.tie(0);
- cout.tie(0);
- string s;
- cin >> s;
- ll n = s.size();
- ll dp[n] = {0};
- ll mod = 1e9+7;
- ll res = s[0] - '0';
- dp[0] = s[0] - '0';
- for (int i = 1; i < n; i++) {
- dp[i] = (((i + 1) * (s[i] - '0')) + (10 * dp[i - 1])) % mod;
- res += dp[i]%mod;
- res %= mod;
- }
- cout << res;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement