#include <cstdio>
#include <cctype>
template <typename T> T read() {
T res = 0, f = 1;
char ch = getchar();
for (; !isdigit(ch); ch = getchar()) if (ch == '-') f = -1;
for (; isdigit(ch); ch = getchar()) res = (res << 3) + (res << 1) + (ch ^ 48);
return res * f;
}
void write(__int128 x, char ed = '\n') {
if (x < 0) x = -x, putchar('-');
static int sta[64], top = 0;
do {
sta[++top] = x % 10;
x /= 10;
} while (x);
while (top) {
putchar(sta[top--] ^ 48);
}
putchar(ed);
}
template <typename T> void write(T x, char ed = '\n') {
write((__int128)x, ed);
}
typedef long long ll;
const ll MOD = 1e9 - 7;
ll kasumi(ll x, ll y) {
ll res = 1;
for (; y; y >>= 1, x = x * x % MOD) if (y & 1) res = res * x % MOD;
return res;
}
int n, m;
int main() {
#ifdef LOCAL
freopen("!input.in", "r", stdin);
freopen("!output.out", "w", stdout);
#else
freopen("game.in", "r", stdin);
freopen("game.out", "w", stdout);
#endif
n = read<int>(), m = read<int>();
write(kasumi(2, n > m ? n : m));
return 0;
}