#include<stdio.h>int main(){ unsigned n; while(scanf("%u",&n)!=EOF) { unsigned a; a=n; n<<=16; n>>=16; a>>=16; a=a^n; n=~n; n<<=16; n+=a; printf("%X\n",n); } return 0;}