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