Var
dat : TextFile;
s : String;
a, k, i : longint; //Int64 //Еxtended
begin
AssignFile(dat, 'bit.dat');
Reset(dat);
Readln(dat, s);
CloseFile(dat);
val( Copy(s, 1, pos(' ', s) - 1), a, i);
val( Copy(s, pos(' ', s) + 1, length(s)), k, i);
AssignFile(dat, 'bit.res');
ReWrite(dat);
Writeln(dat, a shr (k - 1) and 1);
Writeln(dat, a or 1 shl (k - 1));
Writeln(dat, a xor 1 shl (k - 1));
Writeln(dat, a shr (k + 1) shl (k + 1));
Writeln(dat, a shl (sizeOf(a)*8 - k - 1) shr (sizeOf(a)*8 - k - 1));
CloseFile(dat);
end.