#include "bits/stdc++.h" using namespace std; #define print(x) cout< PI; typedef pair V; typedef vector VE; const ll mod = 1000000007; //10^9+7 int main(){ VE v; int V; int ans = 0; while(cin>>V) v.push_back(V); REP(i, 5){ if(v[i] % 15 == 0){ ans += 8; }else if(v[i] % 3 == 0 || v[i] % 5 == 0) { ans += 4; }else{ string s = to_string(v[i]); ans += s.length(); } } print(ans); }