<>; ++$d[$_]for@a=<>; $x>$d[$_]+$d[$_+1] or $x=$d[$_]+$d[$_+1] for @a; print$x;