var a: integer;
begin
readln(a);
digit1:= a div 10;
digit6:= a mod 10;
writeln(digit6 * 100000 + (a mod 10000 div 10) * 10 + digit1)
end.
var a: integer;
begin
readln(a);
digit1:= a div 10;
digit6:= a mod 10;
writeln(digit6 * 100000 + (a mod 10000 div 10) * 10 + digit1)
end.