#include <stdio.h>
unsigned char modifyBit(unsigned char reg, int pos, int mode) {
// Write your code here
if (mode == 0)
{
// clear bit - & with mask of 1's besides the bit at pos
unsigned char mask = ~(1 << pos);
reg &= mask;
}
else
{
// set bit - | with mask of 0's besides the bit at pos
unsigned char mask = 1 << pos;
reg |= mask;
}
return reg;
}
int main() {
unsigned char reg;
int pos, mode;
scanf("%hhu %d %d", ®, &pos, &mode);
printf("%d", modifyBit(reg, pos, mode));
return 0;
}