#include <stdio.h>
c;main(a){scanf("%d%c",&a,&c);printf("%lld",a*1ull<<10*((c&7)/2));}
