var
x : integer;
begin
readln(x);
x := (x div 100 mod 10) * 1000 + (x div 1000) * 100 + (x mod 10) * 10 + (x div 10 mod 10);
writeln(x);
end.
var
x : integer;
begin
readln(x);
x := (x div 100 mod 10) * 1000 + (x div 1000) * 100 + (x mod 10) * 10 + (x div 10 mod 10);
writeln(x);
end.