a = map(int,input().split()) li = list(map(int,input().split())) ans = 0 for i in li: if i <= sum(li)//10: ans += 30 print (ans)