#include using namespace std; #define lli long long int int main() { lli n; cin>>n; lli hash[200005] = {0}; vector population; for(lli i=0;i>popVal; population.push_back(popVal); } map> city; map cityBool; for(lli i=0;i>cityVal; city[cityVal] = make_pair(i,0); cityBool[cityVal] = true; } lli cloudsCount; cin>>cloudsCount; vector cloudsPos; for(lli i=0;i>cloudIndex; cloudsPos.push_back(cloudIndex); } for(lli i=0;i>range; for(lli j= 0-range ; j<= range ; j++){ if(cityBool[cloudsPos[i]+j]){ pair pa = city[cloudsPos[i]+j]; city[cloudsPos[i]+j] = make_pair( pa.first , pa.second + 1); } } } map>::iterator it = city.begin(); lli maxValue = 0; lli sumValue = 0; while(it!=city.end()){ if((it->second.second) == 0){ sumValue += population[it->second.first]; } else if(((it->second.second) == 1) && (maxValue < population[it->second.first])){ maxValue = population[it->second.first]; } it++; } cout<