//FPC 2.6.4
var n: integer;
function prod(a: integer): integer;
var p: integer;
begin
p:=1;
repeat
p:=p*(a mod 10);
a:=a div 10;
until a=0;
result:=p;
end;
function sum(a: integer): integer;
var s: integer;
begin
s:=0;
repeat
inc (s, a mod 10);
a:=a div 10;
until a=0;
result:=s;
end;
begin
readln (n);
if n mod 2 = 0 then write (sum(n)) else write (prod(n));
end.