#include using namespace std; #ifdef LOCAL #include "settings/debug.cpp" #define _GLIBCXX_DEBUG #else #define Debug(...) void(0) #endif #define rep(i, n) for (int i = 0; i < (n); ++i) using ll = long long; using ull = unsigned long long; int f(int x) { int res = 0; if (x % 15 == 0) res = 8; else if (x % 5 == 0) res = 4; else if (x % 3 == 0) res = 4; else res = to_string(x).size(); return res; } int main() { int a, b, c, d, e; cin >> a >> b >> c >> d >> e; cout << f(a) + f(b) + f(c) + f(d) + f(e) << endl; return 0; }