#include <stdio.h>
// 0x1001 1000
// Lấy upper nibble: 1001 <= (0x1001 1000 >> 4)
// Lấy lower niblle: 1000 <= (0x1001 1000 & 0x1111)
unsigned char extractNibble(unsigned char reg, int pos) {
// Write your code here
if (pos) return (reg >> 4) & 0x0F;
return reg & 0x0F;
}
int main() {
unsigned char reg;
int pos;
scanf("%hhu %d", ®, &pos);
printf("%d", extractNibble(reg, pos));
return 0;
}