#include #include #include #define rep(i, a, n) for(int i = a;i < n;i++) using namespace std; int a[5]; int solve(){ int ans = 0; rep(i, 0, 5){ if(a[i] % 3 == 0 && a[i] % 5 == 0) ans += 8; else if(a[i] % 3 == 0 || a[i] % 5 == 0) ans += 4; else ans += (int)log10(a[i]) + 1; } return ans; } int main(){ rep(i, 0, 5) cin >> a[i]; cout << solve() << endl; return 0; }