#include <stdio.h>
unsigned char modifyBit(unsigned char reg, int pos, int mode) {
// Write your code here
if (mode == 1) {
// reg = reg[pos]; lol this doesnt work because its not verilog ...
reg |= (1<< pos);
}
else {
// reg[pos] == 0;
reg &= ~(1 << pos); // technically this is comparing the shifted value to the reg
}
return reg;
}
int main() {
unsigned char reg;
int pos, mode;
scanf("%hhu %d %d", ®, &pos, &mode);
printf("%d", modifyBit(reg, pos, mode));
return 0;
}