import java.util.*;
import java.io.*;
class SelfSynchronizingScrambler
{
private char key, shift_register;
private static int pickbit(char val, int index)
{
return ((val >> index)%2);
}
public SelfSynchronizingScrambler() {}
public SelfSynchronizingScrambler(char key, char shift_register)
{
this.key = key;
this.shift_register = shift_register;
}
public void assignKey(char key) {this.key = key;}
public void assignRegister(char shift_register) {this.shift_register = shift_register;}
public char keyValue() {return key;}
public char registerValue() {return shift_register;}
public char scramble(char letter)
{
char output = 0;
for (char i = 0; i < 8; ++i)
{
int newbit = pickbit(letter, 7-i);
for (char j = 0; j < 8; ++j)
{
newbit ^= pickbit(this.key, 7-j) & pickbit(this.shift_register, 7-j);
}
output ^= (newbit << (7-i));
key = (char)((key >> 1) + (newbit << 7));
}
return output;
}
public char descramble(char letter)
{
char output = 0;
for(char i = 0; i < 8; ++i)
{
int oldbit = pickbit(letter, 7-i), scrambit = 0;
for(char j = 0; j < 8; ++j)
{
scrambit ^= pickbit(this.key, 7-j) & pickbit(this.shift_register, 7-j);
}
output ^= ((scrambit^oldbit) << (7-i));
key = (char)((key >> 1) + (oldbit << 7));
}
return output;
}
};
public class Main
{
{
Scanner in
= new Scanner
(System.
in);
SelfSynchronizingScrambler A = new SelfSynchronizingScrambler((char)5,(char)17);
char scrambled;
while(in.hasNextInt())
{
scrambled = (char)in.nextInt();
out.print(A.descramble(scrambled));
}
out.flush();
}
}