var
sn, s, n, c : integer;
begin
read (n);
c := 0; sn := 0; s := 0;
while n > 0 do
if c mod 2 = 0 then s := s + n mod 10
else sn := sn + n mod 10;
n := n div 10;
inc (c);
end;
if c mod 2 = 0 then writeln (s - sn)
else writeln (sn - s);
end.
var
sn, s, n, c : integer;
begin
read (n);
c := 0; sn := 0; s := 0;
while n > 0 do
begin
if c mod 2 = 0 then s := s + n mod 10
else sn := sn + n mod 10;
n := n div 10;
inc (c);
end;
if c mod 2 = 0 then writeln (s - sn)
else writeln (sn - s);
end.