#include using namespace std; #define rep(i, n) for (int i = 0; i < (n); ++i) int main(void) { const int n = 5; vector a(n); rep(i, n) cin >> a[i]; int cnt = 0; rep(i, n) { if (a[i] % 15 == 0) cnt += 8; else if (a[i] % 3 == 0 && a[i] % 5 != 0) cnt += 4; else if (a[i] % 5 == 0 && a[i] % 3 != 0) cnt += 4; else { if (1 <= a[i] && a[i] <= 9) cnt += 1; else if (10 <= a[i] && a[i] <= 99) cnt += 2; else cnt += 3; } } cout << cnt << endl; return 0; }