#include #include #include #define REP(i, a, b) for (int i = int(a); i < int(b); i++) #define dump(s) cerr << __LINE__ << "\t:" << #s << " = " << (s) << endl using namespace std; int digits(int n) { int ans = 0; do { ans++; n /= 10; } while(n > 0); return ans; } int main () { int a[5] = {}; REP (i, 0, 5) cin >> a[i]; int ans = 0; REP (i, 0, 5) { if (a[i] % 5 == 0) ans += 4; if (a[i] % 3 == 0) ans += 4; if ((a[i] % 3) && (a[i] % 5)) ans += digits(a[i]); //dump(ans); } cout << ans << endl; return 0; }