n=list(map(int,input().split())) count=0 for i in range(len(n)): if n[i]%15==0: count+=8 elif n[i]%3==0: count+=4 elif n[i]%5==0: count+=4 else: count+=1 print(count)