#include <bits/stdc++.h>
using namespace std;
const long long linf = 1e18 + 5;
const int mod = (int)1e9 + 7;
const int logN = 17;
const int inf = 1e9;
const int N = 2e5 + 5;
int temp[1 << 7][1 << 7], res[1 << 7][1 << 7], cur[1 << 7][1 << 7], x;
void mul(int res[][1 << 7], int cur[][1 << 7], int t) {
  t = 1 << t;
  --t;
  memset(temp, 0, sizeof temp);
  for (int i = 0; i <= t; i++)
    for (int j = 0; j <= t; j++)
      for (int k = 0; k <= t; k++)
        temp[i][j] =
            (temp[i][j] + res[i][k] * (long long)cur[k][j] % mod) % mod;
  memcpy(res, temp, sizeof temp);
}
int main() {
  for (int i = 0; i <= (1 << 7) - 1; i++) res[i][i] = 1;
  for (int i = 1; i <= 7; i++) {
    scanf("%d", &x);
    for (int a = 0; a <= (1 << i) - 1; a++)
      for (int b = 0; b <= (1 << i) - 1; b++) {
        cur[a][b] = 0;
        for (int poke = 0; poke <= (1 << i + 1) - 1; poke++) {
          if ((poke & 1) || (poke & (1 << i))) continue;
          if ((((a | b | poke | (poke >> 1)) & ((1 << i) - 1))) == (1 << i) - 1)
            cur[a][b]++;
        }
      }
    while (x) {
      if (x & 1) mul(res, cur, i);
      x >>= 1;
      mul(cur, cur, i);
    }
  }
  cout << res[0][0] << '\n';
  return 0;
}
