#include <bits/stdc++.h>
using namespace std;
int i, j, k, n, m, _, nn, mm;
int a[200], b[200][200], c[200];
inline void mul() {
  int i, j, c[200] = {};
  for (i = 0; i <= m; i++)
    for (j = 0; j <= m; j++) c[j] = (1ll * a[i] * b[i][j] + c[j]) % 1000000007;
  for (i = 0; i <= m; i++) a[i] = c[i];
}
inline void multi() {
  int i, j, k, c[200][200] = {};
  for (k = 0; k <= m; k++)
    for (i = 0; i <= m; i++)
      for (j = 0; j <= m; j++)
        c[i][j] = (1ll * b[i][k] * b[k][j] + c[i][j]) % 1000000007;
  for (i = 0; i <= m; i++)
    for (j = 0; j <= m; j++) b[i][j] = c[i][j];
}
int main() {
  c[0] = 1;
  for (_ = 1; _ <= 7; _++) {
    nn = (1 << _) - 1;
    mm = (1 << _ - 1) - 1;
    memset(b, 0, sizeof(b));
    for (i = 0; i <= nn; i++)
      for (j = 0; j <= mm; j++) {
        int s = 0;
        for (k = 0; k <= _ - 1; k++) {
          int A = 0;
          if (!k) A |= 1;
          if (k == _ - 1) A |= 2;
          if (i >> k & 1) A |= 4;
          if (j >> k & 1) A |= 2;
          if (k && j >> k - 1 & 1) A |= 1;
          if (A != 7) s |= 1 << k;
        }
        for (k = 0; k <= nn; k++)
          if ((s | k) == s) b[i][k]++;
      }
    memset(a, 0, sizeof(a));
    for (i = 0; i <= nn; i++) a[i | (1 << _ - 1)] += c[i];
    m = nn;
    scanf("%d", &n);
    for (; n; n /= 2) {
      if (n & 1) mul();
      multi();
    }
    memcpy(c, a, sizeof(c));
  }
  printf("%d\n", c[m]);
  return 0;
}
