#include using namespace std; #define ll long long int #define rep(i,n) for( int i = 0; i < n; i++ ) #define dump(x) cerr << #x << " = " << (x) << endl; #define INF 2000000000 #define mod 1000000007 #define INF2 1000000000000000000 int mojicnt(int a) { int cnt = 0; while(a > 0) { a /= 10; cnt++; } return cnt; } int main(void) { cin.tie(0); ios::sync_with_stdio(false); int a[5]; rep(i, 5) cin >> a[i]; int ans = 0; rep(i, 5) { if (a[i] % 3 == 0 || a[i] % 5 == 0) { if (a[i] % 15 == 0) ans += 8; else ans += 4; } else ans += mojicnt(a[i]); //dump(ans); } cout << ans << endl; return 0; }