# Zhenhuan

（（21,000,000,006 mod 1,000,000,007 ）-1）吨黄金

/这道题是最萌的(⊙_⊙)？我不知道/

40%的数据：n mod 2==0。0<=ai<=1,000,000,000;
100%的数据：n<=20000。0<=ai<=1,000,000,000;

l[i]=max(a[1]-r[i-1]+a[i-1]+a[i]-K,0)

#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <set>
#include <queue>
#include <algorithm>
#include <vector>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <stack>

using namespace std;

const int N = 20010;
int n,m;
int a[N];

template <class T> inline void read(T &x)
{
x = 0;
int flag = 1;
char ch = (char)getchar();
while(ch<'0' || ch>'9')
{
if(ch=='-') flag = -1;
ch = (char)getchar();
}
while(ch>='0' && ch<='9')
{
x = (x<<1) + (x<<3) + ch-'0';
ch = (char)getchar();
}
x *= flag;
}

void work()
{
for(int i = 1; i < n; i++)
if(m < a[i]+a[i+1]) m = a[i]+a[i+1];
if(m < a[1]+a[n]) m = a[1]+a[n];
}

void work2()
{
for(int i = 1; i < n-1; i++)
if(m < a[i]+a[i+1]+a[i+2]) m = a[i]+a[i+1]+a[i+2];
if(m < a[1]+a[n-1]+a[n]) m = a[1]+a[n-1]+a[n];
if(m < a[1]+a[2]+a[n]) m = a[1]+a[2]+a[n];
}

int main()
{
freopen("zhenhuan.in","r",stdin);
freopen("zhenhuan.out","w",stdout);