program MandarinkovaZed; const MaxN = 1000; var P: array[1..MaxN] of Integer; N: Integer; I, Pm, Ps, S: Integer; begin Readln(N); for I:= 1 to N do Read(P[I]); if N = 1 then Writeln(P[1]) else begin Pm:= P[1] + P[N]; for I:= 1 to N - 1 do if P[I] + P[I + 1] > Pm then Pm:= P[I] + P[I + 1]; if N mod 2 = 0 then Writeln(Pm) else begin S:= 0; for I:= 1 to N do S:= S + P[I]; Ps:= (2*S + N - 2) div (N - 1); if Ps > Pm then Writeln(Ps) else Writeln(Pm); end; end; end.