#include <bits/stdc++.h>
using namespace std;
const int OO = 1e9;
const long long INF = 1e18;
const int irand(int lo, int hi) {
  return ((double)rand() / (RAND_MAX + 1.0)) * (hi - lo + 1) + lo;
}
const long long lrand(long long lo, long long hi) {
  return ((double)rand() / (RAND_MAX + 1.0)) * (hi - lo + 1) + lo;
}
template <typename T>
T getnum() {
  int sign = 1;
  T ret = 0;
  char c;
  do {
    c = getchar();
  } while (c == ' ' || c == '\n');
  if (c == '-')
    sign = -1;
  else
    ret = c - '0';
  while (1) {
    c = getchar();
    if (c < '0' || c > '9') break;
    ret = 10 * ret + c - '0';
  }
  return sign * ret;
}
inline void ini(int& x) { x = getnum<int>(); }
inline void scani(int& x) { scanf("%d", &x); }
const long long MOD = 1e9 + 7;
inline long long addmod(long long a, long long b) {
  if (a + b < MOD) return a + b;
  return a + b - MOD;
}
inline long long mulmod(long long a, long long b) { return (a * b) % MOD; }
const int N = 132;
struct mat {
  int n, m;
  int x[N][N];
  mat() {
    n = m = 0;
    memset(x, 0, sizeof x);
  }
} base[9];
mat operator*(const mat& a, const mat& b) {
  assert(a.m == b.n);
  mat ret;
  ret.n = a.n;
  ret.m = b.m;
  for (int i = 0; i < a.n; i++) {
    for (int j = 0; j < b.m; j++) {
      for (int k = 0; k < a.m; k++) {
        ret.x[i][j] = addmod(ret.x[i][j], mulmod(a.x[i][k], b.x[k][j]));
      }
    }
  }
  return ret;
}
inline void prec() {
  base[1].n = base[1].m = 2;
  base[1].x[0][0] = base[1].x[0][1] = base[1].x[1][0] = 1;
  base[1].x[1][1] = 0;
  for (int i = 2; i <= 7; i += 1) {
    base[i].n = base[i].m = 1 << i;
    for (int lmask = (1 << i) - 1; lmask >= 0; lmask--) {
      for (int midmask = (1 << (i - 1)) - 1; midmask >= 0; midmask--) {
        for (int rmask = (1 << i) - 1; rmask >= 0; rmask--) {
          bool fail = false;
          for (int j = 1, mm = 1; j <= i; j++, mm <<= 1) {
            bool yes = false;
            if (!(lmask & mm)) yes = true;
            if (!(rmask & mm)) yes = true;
            if (j < i && !(midmask & mm)) yes = true;
            if (j > 1 && !(midmask & (mm >> 1))) yes = true;
            if (!yes) {
              fail = true;
              break;
            }
          }
          if (!fail) base[i].x[lmask][rmask]++;
        }
      }
    }
  }
}
mat pow(mat a, int e) {
  assert(a.n == a.m);
  mat ret;
  ret.n = ret.m = a.n;
  for (int i = 0; i < ret.n; i++) ret.x[i][i] = 1;
  while (e) {
    if (e & 1) ret = ret * a;
    a = a * a;
    e >>= 1;
  }
  return ret;
}
int w[9];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cout.setf(ios::fixed);
  cout.setf(ios::showpoint);
  cout.precision(10);
  prec();
  for (int i = 1; i <= 7; i += 1) cin >> w[i];
  mat ans;
  ans.n = 1;
  ans.m = 2;
  ans.x[0][1] = 1;
  for (int i = 1; i <= 7; i += 1) {
    ans = ans * pow(base[i], w[i]);
    if (i < 7) {
      for (int i = 0; i < ans.m; i++) {
        ans.x[0][ans.m + i] = ans.x[0][i];
        ans.x[0][i] = 0;
      }
      ans.m = ans.m << 1;
    }
  }
  cout << ans.x[0][ans.m - 1] << '\n';
  return 0;
}
