#include using namespace std; int main() { int n; cin >> n; int p[n]; int total = 1; for(int i = 0; i < n; i++) { cin >> p[i]; total *= p[i]; } auto f = [&] (int c) { int digit = 0; while(c > 0) { digit += c % 10; c = c / 10; } return digit; }; while(total > 9) { total = f(total); } cout << total << endl; }