#include <stdio.h>
//1010 1011 pos 0 suy ra lấy 4 bit đầu là 0x0000 1011 là 0x0B là 11
//1010 1011 pos 1 suy ra lấy 4 bit sau là 0x1010 0000 là 0x0A là 10
// 0x00001111 << 1 => 0x00011110
unsigned char extractNibble(unsigned char reg, int pos) {
// Write your code here
return (pos == 0)? reg &= 0x0F: reg = ((reg & 0xF0) >> 4) ;
}
int main() {
unsigned char reg;
int pos;
scanf("%hhu %d", ®, &pos);
printf("%d", extractNibble(reg, pos));
return 0;
}