program suma_masuviv;
const n=10;
var a:array [1..n] of integer;
min,max,s,i: integer;
begin
for i:=1 to n do
readln (a[i]);
s:=0;
min:=a[1];
max:=a[1];
for i:=2 to n do
begin
if min>a[i] then min:=a[i];
if max<a[i] then max:=a[i];
end;
s:=min+max;
writeln (s);
readln
end.