var
    x, i, n, curmax : longint;
    ans : int64;
 
begin
    assign(input, 'conquest.in');
    assign(output, 'conquest.out');
    reset(input);
    rewrite(output);
    read(n);
    curMax := maxlongint;
    ans := 0;
    for i := 1 to n - 1 do begin
        read(x);
        if x < curmax then curMax := x;
        ans := ans + curmax;
    end;
    writeln(ans);
end.
