#include <stdio.h>
#include <stdint.h>
void setorclear(uint8_t* reg, uint8_t pos, uint8_t mode) {
if (mode == 1) {
*reg |= (1 << pos);
}
else {
*reg &= ~(1 << pos);
}
}
int main() {
uint8_t reg,pos,mode;
scanf("%hhu%hhu%hhu", ®,&pos,&mode);
setorclear(®, pos, mode);
printf("%hhu", reg);
}