#include <stdio.h>
int ls (int i, int n)
{
for (; n--; i += i);
return i;
}
int rs (int i, int n)
{
int j, p;
for (j = 0, p = 1; p <= i; p = ls (p, 1) )
if (i & ls (p, n) )
j |= p;
return j;
}
int main()
{
int i, n;
scanf ("%d%d", &i, &n);
printf ("%d %d\n", i << n, i >> n);
printf ("%d %d", ls (i, n), rs (i, n) );
}