#include <stdio.h>
#define LOWER_NIBBLE(x) (x & 0x0F)
#define UPPER_NIBBLE(x) ((x >> 4) & 0x0F)
unsigned char extractNibble(unsigned char reg, int pos) {
// Write your code here
if (pos == 0) {
return LOWER_NIBBLE(reg);
}
else{
return UPPER_NIBBLE(reg);
}
}
int main() {
unsigned char reg;
int pos;
scanf("%hhu %d", ®, &pos);
printf("%d", extractNibble(reg, pos));
return 0;
}