#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
long long n, m, tab[102][102], neib[102][102], ans;
vector<int> dirs = {1, 0, 0, 1, -1, 0, 0, -1};
void check() {
  for (int i = 0; i < 10; i++)
    for (int j = 0; j < 10; j++) neib[i][j] = 0;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) {
      for (int o = 0; o < dirs.size(); o += 2)
        if (0 <= i + dirs[o] and i + dirs[o] <= n - 1)
          if (0 <= j + dirs[o + 1] and j + dirs[o + 1] <= m - 1)
            neib[i][j] += (tab[i][j] == tab[i + dirs[o]][j + dirs[o + 1]]);
    }
  for (int i = 0; i < 10; i++)
    for (int j = 0; j < 10; j++)
      if (neib[i][j] > 1) return;
  ans++;
}
int main() {
  ios_base::sync_with_stdio(0);
  cout.tie(0);
  cin.tie(0);
  cin >> n >> m;
  for (int i = 0; i < (1 << (n * m)); i++) {
    for (int j = 0; j < n; j++)
      for (int o = 0; o < m; o++) tab[j][o] = (((1 << (j * m + o)) & i) >= 1);
    check();
  }
  cout << ans << " ";
  long long dp[100002];
  dp[1] = 2;
  dp[2] = 4;
  for (int i = 3; i < 100002; i++) dp[i] = dp[i - 1] + dp[i - 2], dp[i] %= mod;
  cout << (dp[n] + dp[m] - 2) % mod << endl;
  return 0;
}
