# coding: utf-8 # Your code here! n = input().rstrip().split() cnt = 0 for i in n: if int(i) % 3 == 0 and int(i) % 5 == 0: cnt += 8 elif int(i) % 3 == 0: cnt += 4 elif int(i) % 5 == 0: cnt += 4 else: cnt += len(i) print(cnt)