n = int(input()) a = list(map(int,input().split())) sam = sum(a) ans = 0 for i in range(n): if a[i]*10 <= sam: ans += 30 print(ans)