#include<bits/stdc++.h>using namespace std;typedef long long ll;const int MAXN = 1e5+10;const ll M = 1e9+7;struct P{ ll c,w; bool operator<(const P &a)const{ return w > a.w; }}a[MAXN];int main(){ ios::sync_with_stdio(false); cin.tie(0);cout.tie(0); int n; ll tot,ans; tot = ans = 0; c...