#include <stdio.h>
int main() {
unsigned char reg_value;
int bit_pos, mode;
scanf("%hhu %d %d", ®_value, &bit_pos, &mode);
if (bit_pos < 0 || bit_pos > 7 || (mode != 0 && mode != 1)) {
printf("Invalid input
");
return 1;
}
if (mode == 1) {
// Set the bit
reg_value |= (1 << bit_pos);
} else {
// Clear the bit
reg_value &= ~(1 << bit_pos);
}
printf("%u
", reg_value);
return 0;
}