import std.stdio; import std.algorithm; import std.string; import std.conv; void main() { int[1000] lane; immutable n = readln.chomp.to!int; readln.splitter.map!(to!int).copy(lane[]); foreach (i; 2..n) { lane[i] += lane[0..(i - 1)].reduce!max; } writeln(lane[0..n].reduce!max); }