#include <stdio.h>
#include <stdint.h>
uint8_t rotate_left(uint8_t reg, int n){
uint8_t result = (reg << n) | (reg >> (8 - n));
return result;
}
int main(){
uint8_t reg; int pos;
scanf("%hhu %d", ®, &pos);
printf("%hhu", rotate_left(reg, pos));
return 0;
}