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