#include <stdio.h>
unsigned char modifyBit(unsigned char reg, int pos, int mode) {
// Write your code here
unsigned char result = 0;
if(mode == 1)
{
/* set 1 at the position */
result = (reg | (1 << pos));
}
else if(mode == 0)
{
/* clear the bit at position */
result = (reg & (~(1 << pos)));
}
else
{
printf("invalid input \r\n");
}
return result;
}
int main() {
unsigned char reg;
int pos, mode;
scanf("%hhu %d %d", ®, &pos, &mode);
printf("%d", modifyBit(reg, pos, mode));
return 0;
}