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