#include #include using namespace std; namespace mp = boost::multiprecision; int main(){ int N; cin >> N; vector P(N); mp::cpp_int A = 1; for (int i = 0; i < N; i++) { cin >> P[i]; A *= P[i]; } while (A >= 10) { mp::cpp_int B = 0; while (A > 0) { B += A%10; A /= 10; } A = B; } cout << A << endl; return 0; }