#include using namespace std; #define rep(i,a,b) for(LL i = a;ib; i--) #define INF ((1LL<<62)-(1LL<<31)) #define ooki 9,223,372,036,854,775,807 #define tii -9,223,372,036,854,775,808 typedef long long LL; int f(int x){ LL count = 0; while(x>0){ x/=10; count++; } return count ; } int main(){ LL count = 0; rep(i,0,5){ LL a; cin >> a; if(a%3==0&&a%5==0){count+=8;} if(a%3==0&&a%5!=0){count+=4;} if(a%3!=0&&a%5==0){count+=4;} if(a%3!=0&&a%5!=0){count+=f(a);} } cout << count << endl; }