#include <stdio.h>
unsigned char modifyBit(unsigned char reg, int pos, int mode) {
if (mode == 0) {
reg &= ~(1 << pos); // biti sıfırla
} else {
reg |= (1 << pos); // biti set et
}
return reg;
}
int main() {
unsigned char reg;
int pos, mode;
scanf("%hhu %d %d", ®, &pos, &mode);
printf("%hhu\n", modifyBit(reg, pos, mode));
return 0;
}