#include <cstdio>
using namespace std;
inline void printBits(unsigned a){
for(int i = 31; i >= 0; --i)
printf(((a >> i) & 1) ? "1" : "0");
puts("");
}
template<class X> void testShift(X a){
printf("Before:\n");
printBits(a);
a = (a >> 1);
printf("After:\n");
printBits(a);
puts("");
}
int main(){
printf("Signed 15\n");
testShift(15);
printf("Signed -15\n");
testShift(-15);
printf("Unsigned 15\n");
testShift(unsigned(15));
printf("Unsigned -15\n");
testShift(unsigned(-15));
return 0;
}
I2luY2x1ZGUgPGNzdGRpbz4KCnVzaW5nIG5hbWVzcGFjZSBzdGQ7CgppbmxpbmUgdm9pZCBwcmludEJpdHModW5zaWduZWQgYSl7CiAgICBmb3IoaW50IGkgPSAzMTsgaSA+PSAwOyAtLWkpCiAgICAgICAgcHJpbnRmKCgoYSA+PiBpKSAmIDEpID8gIjEiIDogIjAiKTsKICAgIHB1dHMoIiIpOwp9Cgp0ZW1wbGF0ZTxjbGFzcyBYPiB2b2lkIHRlc3RTaGlmdChYIGEpewogICAgcHJpbnRmKCJCZWZvcmU6XG4iKTsKICAgIHByaW50Qml0cyhhKTsKICAgIGEgPSAoYSA+PiAxKTsKICAgIHByaW50ZigiQWZ0ZXI6XG4iKTsKICAgIHByaW50Qml0cyhhKTsKICAgIHB1dHMoIiIpOwp9CgppbnQgbWFpbigpewoKICAgIHByaW50ZigiU2lnbmVkIDE1XG4iKTsKICAgIHRlc3RTaGlmdCgxNSk7CiAgICBwcmludGYoIlNpZ25lZCAtMTVcbiIpOwogICAgdGVzdFNoaWZ0KC0xNSk7CgogICAgcHJpbnRmKCJVbnNpZ25lZCAxNVxuIik7CiAgICB0ZXN0U2hpZnQodW5zaWduZWQoMTUpKTsgIAogICAgcHJpbnRmKCJVbnNpZ25lZCAtMTVcbiIpOwogICAgdGVzdFNoaWZ0KHVuc2lnbmVkKC0xNSkpOwoKICAgIHJldHVybiAwOwp9Cg==