#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long int lint; typedef pair P; typedef pair LLP; #define rep(i, n) for (int i = 0; i < n; i++) #define repr(i, n) for (int i = n; i >= 0; i--) #define sort(v) sort((v).begin(), (v).end()) #define reverse(v) reverse((v).begin(), (v).end()) /* vectoral(26); al = {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'}; vectorAL(26); AL = {'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'}; */ int main() { int N; cin >> N; vectorP(N); rep(i, N) { cin >> P[i]; } lint p = 0; rep(i, N) { while (P[i] >= 10) { while (P[i] != 0) { p += P[i] % 10; P[i] /= 10; } P[i] = p; p = 0; } } lint ans = 1; rep(i, N) { ans *= P[i]; } while (ans >= 10) { while (ans != 0) { p += ans % 10; ans /= 10; } ans = p; p = 0; } cout << ans << endl; }