# -*- coding: utf-8 -*- n = int(input()) c = list(map(int,input().split())) c_sum = sum(c) c_line = c_sum / 10 money = 0 for i in range(n): if c[i] <= c_line: money += 30 print(money)