#include <stdio.h>
unsigned char modifyBit(unsigned char reg, int pos, int mode) {
// Write your code here
if(mode == 0)
{
// To clear a bit we would and all remaining bits with 1 except for that one
reg = reg & ~(1 << pos);
}
else
{
// To set a bit we OR the register with the bit set in its location
reg = reg | (1 << pos);
}
return reg;
}
int main() {
unsigned char reg;
int pos, mode;
scanf("%hhu %d %d", ®, &pos, &mode);
printf("%d", modifyBit(reg, pos, mode));
return 0;
}