var a: array [1..15] of integer;
i, n, s, p: integer;
begin
s:=0;
p:=1;
Read(n);
For i:= 1 to n do
Read(a[i]);
For i:=1 to n do
if a[n]<30 then begin
s:=s+a[i];
p:=p*a[i];
end;
Write(s, ' ', p);
end.
s,pr = 0,1
Y = []
for i in range(30):
Y.append(int(input()))
if Y[i] < 30:
s += Y[i]
pr *= Y[i]
print(s,pr)
var a: array [1..15] of integer;
i, n, s, p: integer;
begin
s:=0;
p:=1;
Read(n);
For i:= 1 to n do
Read(a[i]);
For i:=1 to n do
if a[n]<30 then begin
s:=s+a[i];
p:=p*a[i];
end;
Write(s, ' ', p);
end.
s,pr = 0,1
Y = []
for i in range(30):
Y.append(int(input()))
for i in range(30):
if Y[i] < 30:
s += Y[i]
pr *= Y[i]
print(s,pr)