import std.stdio, std.conv, std.string, std.bigint; import std.math, std.random, std.datetime; import std.array, std.range, std.algorithm, std.container; string read(){ static string[] ss; while(!ss.length) ss = readln.chomp.split; string res = ss[0]; ss.popFront; return res; } void main(){ int n = read.to!int; int[] vs = readln.chomp.split.map!(to!int).array; int a, b; a = vs[0], b = 0; for(int i = 1; i < n; i ++){ int a2, b2; if(a > b) b2 = a; else b2 = b; a2 = b + vs[i]; a = a2, b = b2; } if(a > b) a.writeln; else b.writeln; }