#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long ll; typedef vector vi; typedef pair pii; #define MP make_pair #define PB push_back #define inf 1000000007 #define rep(i,n) for(int i = 0; i < (int)(n); ++i) #define all(x) (x).begin(),(x).end() template void Fill(A (&array)[N], const T &val){ std::fill( (T*)array, (T*)(array+N), val ); } template inline bool chmax(T &a, T b){ if(a inline bool chmin(T &a, T b){ if(a>b){ a = b; return true; } return false; } int main(){ int n; cin >> n; int s,t; cin >> s >> t; s--;t--; vector a(n); rep(i,n) cin >> a[i]; ll sm = accumulate(all(a),0LL); int L = 0; int R = 0; int b = s; int c = t; bool f = 0; while(abs(b-c)>1){ if(!f){ f = 1; b++; if(b>=n)b-=n; if(b==c){ b--; if(b<0)b+=n; break; } }else{ f = 0; c--; if(c<0)c+=n; } } L = b; b = s; c = t; f = 0; while(abs(b-c)>1){ if(!f){ f = 1; b--; if(b<0)b+=n; if(b==c){ b++; if(b>=n)b-=n; break; } }else{ f = 0; c++; if(c>=n)c-=n; } } R = b; if(L>R){ swap(L,R); } cerr << L << " " << R << endl; int m; if(n%2==0){ m = n/2; }else{ m = n/2+1; } ll mx = 0; if(s>=L){ ll t = 0; int p,q; for(int i=0;i