#include using namespace std; using ll=long long; #define rep2(i, a, n) for(int i = (a); i < (n); i++) #define rep(i, n) rep2(i,0,n) #define infl 1LL<<60; template inline bool chmax(T& a, T b){if(a>n; int a[n*2]; rep(i,n*2)cin>>a[i]; ll ans=-infl; ll tot=0; rep(i,n*2){ if(i%2==0)tot-=a[i]; else tot+=a[i]; } chmax(ans,tot); rep(i,n){ int first=a[i*2],second=a[i*2+1]; tot+=first-second; tot+=first-second; chmax(ans,tot); } cout<