#include <bits/stdc++.h>
using namespace std;
const int maxn = (5e5) + 10, maxm = (1 << 7) + 10, mod = 1e9 + 7;
int w[8];
struct mat {
  int n, m;
  int M[maxm][maxm];
  mat() { memset(M, 0, sizeof M); }
  int* operator[](int x) { return M[x]; }
};
mat emp, iden, A[8], b;
mat zar(mat a, mat b, int x) {
  int somenum = 0;
  for (int i = x; i < 7; i++) somenum += (1 << i);
  mat ans;
  ans.n = a.n, ans.m = b.m;
  int r = a.m;
  for (int i = 0; i < (1 << x); i++)
    for (int j = 0; j < (1 << x); j++)
      for (int k = 0; k < (1 << x); k++)
        ans[i + somenum][j + somenum] =
            (ans[i + somenum][j + somenum] +
             (1ll * a[i + somenum][k + somenum] * b[k + somenum][j + somenum]) %
                 mod) %
            mod;
  return ans;
}
mat tav(mat a, int r, int z) {
  iden.n = a.n;
  iden.m = a.m;
  if (r == 0) return iden;
  mat ans = iden;
  ans.n = a.n;
  ans.m = a.m;
  ans = tav(a, (r >> 1), z);
  ans = zar(ans, ans, z);
  if (r % 2) ans = zar(ans, a, z);
  return ans;
}
bool check(int x, int y, int z, int h) {
  for (int i = 0; i < h; i++) {
    int r1 = x & (1 << i), r2 = y & (1 << i), r3 = z & (1 << i),
        r4 = z & (1 << (max(i - 1, (int)0)));
    if (i == 0) r4 = 1;
    if (i == h - 1) r3 = 1;
    if (r1 && r2 && r3 && r4) return 0;
  }
  for (int i = h; i < 7; i++)
    if (!(((1 << i)) & x) || (!((1 << i) & y))) return 0;
  return 1;
}
int32_t main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  for (int i = 1; i <= 7; i++) scanf("%d", &w[i]);
  for (int i = 0; i < maxm; i++) iden[i][i] = 1;
  iden.n = maxm;
  iden.m = maxm;
  b.n = (1 << 7), b.m = 1;
  b[(1 << 7) - 1][0] = 1;
  for (int i = 1; i <= 7; i++)
    for (int x = 0; x < (1 << 7); x++)
      for (int y = 0; y < (1 << 7); y++)
        for (int z = 0; z < (1 << (i - 1)); z++)
          if (check(x, y, z, i)) A[i][x][y] = (A[i][x][y] + 1) % mod;
  for (int i = 1; i <= 7; i++) A[i].n = (1 << 7), A[i].m = (1 << 7);
  for (int i = 1; i <= 7; i++) A[i] = tav(A[i], w[i], i);
  iden.n = A[1].n, iden.m = A[1].m;
  mat ans = iden;
  for (int i = 1; i <= 7; i++) ans = zar(A[i], ans, i);
  ans = zar(ans, b, 7);
  printf("%d\n", ans[(1 << 7) - 1][0]);
  return 0;
}
