#include <bits/stdc++.h>
using namespace std;
const int N = 7;
const int mod = 1e9 + 7;
void madd(int& a, int b) {
  a += b;
  if (a >= mod) a -= mod;
}
int mul(int a, int b) { return ((long long)a * b) % mod; }
int mpow(int a, int n) {
  int r = 1;
  while (n > 0) {
    if (n & 1) r = mul(r, a);
    a = mul(a, a);
    n >>= 1;
  }
  return r;
}
int f[1 << N];
int g[1 << N];
int t[1 << N][1 << N];
int m[1 << N][1 << N];
int r[1 << N][1 << N];
int tmp[1 << N];
void transition(int a[1 << N][1 << N], int b[1 << N][1 << N], int size) {
  memset(t, 0, sizeof t);
  for (int i = 0; i < size; i++)
    for (int j = 0; j < size; j++)
      for (int k = 0; k < size; k++) madd(t[i][j], mul(a[i][k], b[k][j]));
  memcpy(a, t, sizeof t);
}
int main() {
  int n, last = 0;
  f[0] = 1;
  for (int i = 1; i <= N; i++) {
    scanf("%d", &n);
    if (n == 0) continue;
    int size = (1 << i);
    memset(m, 0, sizeof m);
    for (int j = 0; j < size; j++) {
      for (int k = 0; k < size; k++) {
        for (int l = 1 | (1 << (i)); l < (1 << (i + 1)); l += 2) {
          bool bad = false;
          for (int u = 0; u < i && !bad; u++)
            bad |= (((l) >> (u)) & 1) && (((l) >> (u + 1)) & 1) &&
                   (((j) >> (u)) & 1) && (((k) >> (u)) & 1);
          m[j][k] += !bad;
        }
      }
    }
    int push = ((1 << (i - last)) - 1) << last;
    for (int j = 0; j < (1 << last); j++) {
      f[j | push] = f[j];
      f[j] = 0;
    }
    memset(r, 0, sizeof r);
    for (int j = 0; j < size; j++) r[j][j] = 1;
    for (; n > 0; n >>= 1, transition(m, m, size))
      if (n & 1) transition(r, m, size);
    memset(tmp, 0, sizeof tmp);
    for (int j = 0; j < size; j++)
      for (int k = 0; k < size; k++) madd(tmp[j], mul(f[k], r[j][k]));
    memcpy(f, tmp, sizeof tmp);
    last = i;
  }
  printf("%d\n", f[(1 << (last)) - 1]);
  return 0;
}
