#include using namespace std; using ll = long long; #define rep(i, n) for (int i = 0; i < (int)(n); i++) void solve() { vector a(6, vector(6)); rep(i, 6) { string s; cin >> s; rep(j, 6) a[i][j] = s[j] - '0'; } ll ans = 1; rep(j, 6) { bool ok = false, ff = false, ef = false; rep(i, 6) { ok |= a[i][j] != 5 && a[i][j] % 2 == 1; ff |= a[i][j] == 5; ef |= a[i][j] != 0 && a[i][j] % 2 == 0; } if (ok || (ff && ef)) { ans *= 10; } else if (ff) { ans *= 2; } else if (ef) { ans *= 5; } } cout << ans << '\n'; } int main() { std::cin.tie(nullptr); std::ios_base::sync_with_stdio(false); int T = 1; for (int t = 0; t < T; t++) { solve(); } return 0; }