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