n = input() a = map(int, raw_input().split()) m = sum(a) ans = 0 for i in xrange(n): ans += 30 * (m == 0 or 0.1 >= 1.0 * a[i] / m) print ans