#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; using ll = long long; using Pll = pair; using Pii = pair; constexpr ll MOD = 1000000007; constexpr long double EPS = 1e-10; constexpr int dyx[4][2] = { { 0, 1}, {-1, 0}, {0,-1}, {1, 0} }; vector to_vec(ll n) { vector v; while(n) { v.push_back(n % 10); n /= 10; } return v; } vector product(vector &x, vector &y) { // z = x * y; int n = x.size(); int m = y.size(); vector z; for(int j=0;j> n; ll p; cin >> p; vector mul = to_vec(p); for(int i=1;i> p; vector v = to_vec(p); mul = product(mul, v); // for(int j=mul.size()-1;j>=0;--j) cerr << mul[j]; // cerr << endl; } ll digit_sum = 0LL; for(int i=0;i= 10) { digit_sum = calc_digit_sum(digit_sum); } cout << digit_sum << endl; }