ans = 0 for i in input().split(): x = (int(i)%5==0) + (int(i)%3==0) ans += (4*x if x else len(i)) print(ans)