#include <bits/stdc++.h>
#define f first
#define s second
#define fore(i,a,b) for(int i = (a), ThxMK = (b); i < ThxMK; ++i)
#define pb push_back
#define all(s) begin(s), end(s)
#define _ ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define sz(s) int(s.size())
#define ENDL '\n'
#define vv(type, name, h, ...) vector<vector<type>> name(h, vector<type>(__VA_ARGS__))
#define vvv(type, name, h, w, ...) vector<vector<vector<type>>> name(h, vector<vector<type>>(w, vector<type>(__VA_ARGS__)))
using namespace std;
typedef long double ld;
typedef long long lli;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<lli> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef vector<ii> vii;
typedef vector<string> vs;
#define deb(x) cout << #x": " << (x) << endl;

lli gcd(lli a, lli b){return (b?gcd(b,a%b):a);}
lli lcm(lli a, lli b){ if(!a || !b) return 0; return a * b / gcd(a, b); }
int popcount(lli x) { return __builtin_popcountll(x); }

 mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 int rnd(int n){return uniform_int_distribution<int>(0, n-1)(rng);}

lli poww(lli a, lli b){
	lli res =1;
	while(b){ if(b&1) res = res * a; a = a*a; b/=2; }
	return res;
}
bool isPrime(lli x){
	if(x==1 or (x%2==0 and x>2))return 0;
	for(lli i = 3; i*i<=x; i+=2)if(x%i==0)return 0;
	return 1;
}
vi sieve(int N){
	vi m(N+1,0);
	vi primes(1,2);
	for(int i = 4; i<N; i+=2)m[i]=1;
	for(int i = 3; i*i<=N; i+=2)if(!m[i])for(int j = i*i; j<N; j+=i)m[j]=1;
	for(int i = 3; i<N; i+=2)if(!m[i])primes.pb(i);
	return primes;
}
int dx[4]={0,0,1,-1}, dy[4]={1,-1,0,0};
vvi graph(int n, int m, bool dir=1){
	vv(int,v,n+1,0);
	fore(i,0,m){
		int a,b; cin>>a>>b;
		v[a].pb(b);
		if(dir)v[b].pb(a);
	}
	return v;
}
template <typename T> static constexpr T inf = numeric_limits<T>::max() / 2;
// ---- コーディングはここから！ ('-')7

void solve(){
	int n; cin>>n;
	vl v(n); fore(i,0,n)cin>>v[i];
	vl pre(n+1,0); fore(i,0,n)pre[i+1]=pre[i]+v[i];
	lli sum =0;
	lli mx = 0;
	lli m = 0;
	fore(i,0,n){
		m = max(m,pre[i]);
		mx = max(mx,sum+m),sum=sum+pre[i+1];
	}
	mx=max(mx,sum);
	cout<<mx<<ENDL;

}

int main(){_
	//int t; cin>>t; while(t--)
	solve();
}

#include <iostream>
#include <bits/stdc++.h>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <bitset>

using namespace std;
typedef long long ll;
typedef long double ld;

ll temp1,temp2,temp;
char tempc;

#define forn(i,n) for(int i=0;i<int(n);i++)
#define FOR(i,a,b) for(int i=int(a);i<int(b);i++)

#define N 1000000009
#define mp make_pair
#define pb push_back
#define F first
#define S second
#define pi pair<int,int>
#define pl pair<ll,ll>
#define int ll
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL)
#define vi vector<int>

ll binpow(ll a, ll b)
{
    a%=N;b=b%(N-1);
    ll res=1;
    while(b>0)
    {
        if(b&1) res=res*a%N;
        a=a*a%N;
        b>>=1;
    }
    return res%N;
}

int simpow(int a,int b)
{
    // b=b%(N-1);
    ll res=1;
    while(b>0)
    {
        if(b&1) res=res*a;
        a=a*a;
        b>>=1;
    }
    return res;
}

int gcd(int a,int b)
{
    if (b == 0) 
        return a; 
    return gcd(b, a % b);  
}

int mini(int a,int b)
{
    if(a<b) return a;
    return b;
}

int maxi(int a,int b)
{
    if(a>b) return a;
    return b;
}

struct DSU {
    vector<int> sz;
    vector<int> parent;
 
    void make_set(int v) {
        parent[v] = v;
        sz[v] = 1;
    }
 
    int find_set(int v) {
        if (v == parent[v])
            return v;
        return parent[v] = find_set(parent[v]);
    }
 
    void union_sets(int a, int b) {
        a = find_set(a);
        b = find_set(b);
        if (a != b) {
            if (sz[a] < sz[b])
                swap(a, b);
            parent[b] = a;
            sz[a] += sz[b];
        }
    }
 
    DSU(int n) {
        sz.resize(n+1);
        parent.resize(n+1);
        for (int i = 1; i <= n; i++) make_set(i);
    }
};

signed main() {

    #ifndef ONLINE_JUDGE
    // for getting input from input.txt
    freopen("inputf.in", "r", stdin);
    // for writing output to output.txt
    freopen("outputf.in", "w", stdout);
    #endif

    string s; cin >> s;
    int l = s.length(); bool flag = true;
    forn(i,l) {
        if(i%2==0){ 
            if(isupper(s[i])) flag = false;
            // break;
        }
        else {
            if(islower(s[i])) flag=false;
            // break;
        }
    }
    if(flag) cout << "Yes" << endl;
    else cout << "No" << endl;
}

