#include <bits/stdc++.h>
#define clr(str , charr) memset(str,charr, sizeof(str))
using namespace std;
using namespace std::chrono;
const int mod = 1e9 +5;
#define test int t; cin>>t; while(t--)
#define print( i , output ) cout << "Case #" << i << ": " << output ;
#define ll long long
#define pi 3.1415926
#define l length()
#define preci(x) cout << fixed<<setprecision(x)
#define infmax LONG_LONG_MAX
#define infmin LONG_LONG_MIN
#define bit __builtin_popcountll /*It returns the numbers of set bits in an integer
(the number of ones in the binary representation of the integer).*/
#define all(v) (v).begin(),(v).end()
#define sz(v) (((int)((v).size())))
void fast(){
ios_base::sync_with_stdio(0);cin.tie(0); cout.tie(0);
}
void solve ()
{
int x, y ; ll sum1 =0 , sum2 =0;
int n; cin>>n;
while(n--)
{
cin>>x>>y;
sum1+=x;
sum2+=y;
}
cout << max(sum2 , sum1) + abs(sum1 - sum2) ;
}
int main()
{
//fast();
//test
solve();
//calctime();
}
Copy