#include using namespace std; signed main(){ int N; cin >> N; vector< int > A( N ); for( int i = 0; i < N; ++i ) cin >> A[ i ]; int sum = 0; for( int i = 0; i < N; ++i ) sum += A[ i ]; int cnt = 0; for( int i = 0; i < N; ++i ) sum += A[ i ] * 10 <= sum; cout << cnt * 30 << endl; return 0; }