#include #include #include #include #include #include #include using namespace std; int main() { int n; cin >> n; long long ans = 1; for (int i=0; i> p; if (p%9 == 0) p = (p==0? 0 : p%9); ans *= p; } cout << ans << endl; }