f = lambda s: int(s)%15==0 and 8 or (int(s)%3==0 or int(s)%5==0) and 4 or len(s) print(sum(map(f, input().split())))