#include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long ll; int main(){ ll a[5]; cin >> a[0] >> a[1] >> a[2] >> a[3] >> a[4]; ll res = 0; for(int i = 0;i < 5;i++){ if(a[i] % 3 == 0 && a[i] % 5 == 0)res += 8; else if(a[i] % 3 * a[i] % 5 != 0){ string s = to_string(a[i]); res += s.size(); } else res += 4; } cout << res << endl; }