a=0 for x in list(map(int,input().split())): if x%3==0:a+=4 if x%5==0:a+=4 if x%3 and x%5:a+=len(str(x)) print(a)