/** * @FileName a.cpp * @Author kanpurin * @Created 2020.06.04 14:04:59 **/ #include "bits/stdc++.h" using namespace std; typedef long long ll; int main() { string s;cin >> s; bool zoro = true; bool two = true; bool three = true; bool four = true; bool five = true; bool nine = true; int sum = 0; for (int i = 0; i < s.size(); i++) { if (i >= 1 && s[i] != s[i-1]) { zoro = false; } if ((s[i] - '0') % 2 != 0) { two = false; } if ((s[i] - '0') % 4 != 0) { four = false; } if ((s[i] - '0') % 5 != 0) { five = false; } sum += s[i]-'0'; } if (zoro) { cout << s << endl; return 0; } if (sum % 3 != 0) { three = false; } if (sum % 9 != 0) { nine = false; } ll ans = 1; if (two) ans*=2; if (three) ans*=3; if (four) ans*=2; if (five) ans*=5; if (nine) ans *= 3; cout << ans << endl; return 0; }