#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++) #define rep(i, n) repr(i, 0, n) #define INF 2e9 //#define MOD 1000000007 #define MOD 998244353 #define LINF (long long)4e18 #define jck 3.141592 const double EPS = 1e-10; using ll = long long; using Pi = pair; using Pl = pair; int main(){ int N; cin >> N; vector P(N); rep(i,N) cin >> P[i]; ll tmp = 1; rep(i,N){ string k = to_string(P[i]); int m = k.size(); int now = 0; rep(j,m){ now += k[j]-'0'; } tmp *= now; string t = to_string(tmp); while(true){ if(t.size() == 1) break; int s = t.size(); int now = 0; rep(i,s){ now += t[i]-'0'; } t = to_string(now); } tmp = stoi(t); } cout << tmp << endl; }