#include <stdio.h>
enum {
BIT_CLEAR_MODE,
BIT_SET_MODE,
BIT_NONE_MODE,
};
unsigned char modifyBit(unsigned char reg, int pos, int mode) {
// Write your code here
if (mode == BIT_SET_MODE) {
return reg | (1 << pos);
} else if (mode == BIT_CLEAR_MODE) {
return reg & ~(1 << pos);
} else {
return reg;
}
}
int main() {
unsigned char reg;
int pos, mode;
scanf("%hhu %d %d", ®, &pos, &mode);
printf("%d", modifyBit(reg, pos, mode));
return 0;
}