#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #define REP(i,n) for(i=0;i( \ ( std::ostringstream() << std::dec << x ) ).str() using namespace std; typedef long long unsigned int llu; typedef long long ll; int main (){ int a[5]; while(cin >> a[0] >> a[1] >> a[2] >> a[3] >> a[4]){ int i,cnt = 0; REP(i,5){ if(a[i] % 15 == 0){ cnt += 8; }else if(a[i] % 3 == 0){ cnt += 4; }else if(a[i] % 5 == 0){ cnt += 4; }else{ string s = SSTR(a[i]); cnt += s.length(); } } cout << cnt << endl; } return 0; }