n=int(input()) c=list(map(int,input().split())) u=sum(c) ans = 0 for i in c: if i*10 <= u: ans += 30 print(ans)