#include #include int main() { uint32_t n; std::cin >> n; uint64_t s = 1; for (uint32_t i = 0; i < n; ++i) { uint64_t p; std::cin >> p; s *= p; } std::string t = std::to_string(s); while (t.size() != 1) { uint64_t u = 0; for (auto c : t) { u += c - '0'; } s = u; t = std::to_string(s); } std::cout << s << std::endl; }