a=input().split() b=0 for i in a: if (int(i)%3==0) and (int(i)%5==0): b+=8 elif (int(i)%3==0) or (int(i)%5==0): b+=4 else: b+=len(i) print(b)