#include<bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);
#define int long long
#define lld long double
#define inf 1000000000
#define pii pair<int,int>
#define fi first
#define se second
#define pb push_back
#define mod 1000000007
#define mod2 998244353
#define all(x) (x).begin(), (x).end()
#define rep(i,x,y) for(int i=x; i<y; i++)
#define fill(a,b) memset(a, b, sizeof(a))
#define vi vector<int>
#define setbits(x) __builtin_popcountll(x)
#define w(x)  int x; cin>>x; while(x--)
#define in(a) for(auto &x: a)cin>>x;
int h,w,a,b,cnt=0;
pair<int,int> nxt(int i,int j,vector<vector<bool>> &mat){
	int I=-1,J=-1;
	for(int I=i;I<h;I++){
		for(int J=0;J<w;J++){
			if(I==i && J<=j)continue;
			if(mat[I][J])continue;
			return {I,J};
		}
	}
	return {-1,-1};
}
void fun(int i,int j,vector<vector<bool>> &mat,int x,int y){
	if(x==0 && y==0){cnt++;return;}
	if(j+1<w && mat[i][j+1]==0 && x){
		mat[i][j]=mat[i][j+1]=1;
		pii nx=nxt(i,j,mat);
		fun(nx.fi,nx.se,mat,x-1,y);
		mat[i][j]=mat[i][j+1]=0;
	}
	if(i+1<h && mat[i+1][j]==0 && x){
		mat[i][j]=mat[i+1][j]=1;
		pii nx=nxt(i,j,mat);
		fun(nx.fi,nx.se,mat,x-1,y);
		mat[i][j]=mat[i+1][j]=0;
	}
	if(y){
		mat[i][j]=1;
		pii nx=nxt(i,j,mat);
		fun(nx.fi,nx.se,mat,x,y-1);
		mat[i][j]=0;
	}
	
}
signed main(){
    cin>>h>>w>>a>>b;
    vector<vector<bool>> mat(h,vector<bool>(w,false));
    fun(0,0,mat,a,b);
    cout<<cnt;
    return 0;
}
#include<bits/stdc++.h>
#include<chrono>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace std::chrono;
using namespace __gnu_pbds;
#define ll long long int
#define ull unsigned long long int
#define FOR(I,a,b) for(int I=a;I<b;I++)
#define FORit(it,a) for(auto it=a.begin();it!=a.end();it++)
#define ROF(I,a,b) for(int I=a;I>=b;I--)
#define vec vector
#define vi vec<int>
#define vll vec<ll>
#define pb push_back
#define pp pop_back
#define all(x) x.begin(),x.end()
#define testcases ll t;cin>>t;while(t--)
#define mem(a,k) memset(a,k,sizeof(a))
#define FF first
#define SS second
#define MP(x,y) make_pair(x,y)
#define rt return
#define br break
#define ct continue
#define elif else if
#define ii pair<int,int>
#define vecin(a,n,index) for(int I=index;I<n;I++)cin>>a[I]
#define vecout(a,n,index) for(int I=index;I<n;I++)cout<<a[I]<<" ";cout<<endl;
//ll mod = 1000000007;
template<class T> using oset = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template<class T> using omset = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;

void solve() {
	int n;
	cin >> n;
	vll v(n);
	vecin(v, n, 0);
	vll p = v;
	FOR(i, 1, n)p[i] += p[i - 1];
	ll maxe = 0, ans = 0, cur = 0;
	FOR(i, 0, n) {
		maxe = max(maxe, p[i]);
		ans = max(ans, maxe + cur);
		cur += p[i];
	}
	cout << ans << endl;
}

int main()
{
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	ios_base::sync_with_stdio(false);	cin.tie(NULL);	cout.tie(NULL);
	// START FROM HERE :)
	solve();
}