n=int(input()) c=[int(i) for i in input().split()] sum=0 for i in c: sum+=i cost=0 for i in c: if i/sum<=1/10: cost+=30 print(cost)