#include using namespace std; typedef long long ll; ll kkkkkkk() { ll n; cin >> n; ll a[n]; for(ll i = 0;i < n;i++) cin >> a[i]; sort(a,a+n); ll j = 0,ans = 0; for(ll i = n -1;i >= 0;i--) { ans += a[i]*(ll)pow(2,j); j++; } cout << ans; return 0; } int rhhhhhh() { ll n; cin >> n; ll a[n]; for(ll i = 0;i < n;i++) cin >> a[i]; sort(a,a+n); ll j = 0,ans = 0; for(ll i = n -1;i >= 0;i--) { ans += a[i]*(ll)pow(2,j); j++; } cout << ans; return 0; } int main() { ll n,x,y; cin>>n>>x>>y; ll ans=0; vector > > > v(n); for(ll i=0;i>v[i].second.first>>v[i].second.second.first>>v[i].first>>v[i].second.second.second; ans += v[i].second.second.second; } sort(v.rbegin(),v.rend()); ll prelon=v[0].second.second.second; ll preh=v[0].second.first; ll prelat= v[0].second.second.first; ll ans1=v[0].first; for(ll i=1;i