#include using namespace std; /*{{{*/ //template #define REP(i,n) for(int i=0;i ostream& operator<<(ostream& os,const vector& vec){ os << "["; for(const auto& v : vec){ os << v << ","; } os << "]"; return os; } template ostream& operator<<(ostream& os,const pair& p){ os << "(" << p.first << ","<< p.second <<")"; return os; } typedef long long ll; typedef unsigned long long ull; typedef pair pii; typedef vector vi; typedef vector vvi; ll gcd(ll a,ll b){ if(b==0) return a; else return gcd(b,a%b); } constexpr ll mod = 1e9+7; const int dx[]={1,0,-1,0} ,dy[] = {0,1,0,-1}; /*}}}*/ int main(){ int N;cin>>N; vector L(N); rep(i,N) cin>>L[i]; int T;cin>>T; vector names(T); vector ps(T); rep(i,T) cin>>names[i]>>ps[i]; map> hoge; map mp; vector cnt(N,0); map> score; set st; map ls; rep(i,T){ string n = names[i]; st.insert(n); int idx = ps[i]-'A'; int star = L[idx]; cnt[idx]++; int acn = cnt[idx]; int point = 50 * star + (50 * star / (0.8 + 0.2*acn)); score[n][idx] = point; hoge[n].push_back(point); ls[n] = i; } using P = pair>; vector

vp; for(auto a : hoge){ string name = a.first; auto v = a.second; int sum = 0; for(int i=0;i