L=input().split() O=0 for A in L: B=int(A) if B%5==0:O+=4 if B%3==0:O+=4 elif B%5:O+=len(A) print(O)