#include using namespace std; long long jury(int N,vector A,int Add,int Max,int Min){ int dep = 0; auto dfs = [&](auto dfs,vector now,int ad,int ma,int mi,long long x) -> long long { dep++; int n = now.size(); if(n == 0){ dep--; return x; } long long ret = 0; for(int i=0; i> N; bool test = false; while(true){ vector Akane(N); int Add = 0,Max = 0,Min = 0; if(test == false) for(auto &a : Akane) cin >> a; if(test) for(auto &a : Akane) a = mt()%9+1; for(int i=0; i> s; if(s == "add") Add++; else if(s == "max") Max++; else Min++; } sort(Akane.rbegin(),Akane.rend()); if(Min == N){ continue; cout << 0 << endl; //かわいそう. return 0; } long long answer = Akane.at(Min); for(int i=Min+Max+1; i