#include <bits/stdc++.h>
#pragma GCC optimize("Ofast,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx")
#pragma GCC target("avx,tune=native")
using namespace std;
const long long mod = 1e9 + 7;
long long w[11];
vector<vector<long long> > mul(vector<vector<long long> >& a,
                               vector<vector<long long> >& b) {
  vector<vector<long long> > ret(a.size(), vector<long long>(a.size(), 0));
  for (long long i = 0; i < a.size(); i++)
    for (long long j = 0; j < a.size(); j++) ret[i][j] = 0;
  for (long long i = 0; i < a.size(); i++) {
    for (long long j = 0; j < a.size(); j++) {
      for (long long k = 0; k < a.size(); k++) {
        ret[i][j] += a[i][k] * b[k][j];
        ret[i][j] %= mod;
      }
    }
  }
  return ret;
}
vector<vector<long long> > Pow(vector<vector<long long> > a, long long k) {
  vector<vector<long long> > ret = a, m = a;
  k--;
  do {
    if (k & 1) ret = mul(ret, m);
    m = mul(m, m);
  } while (k >>= 1);
  return ret;
}
long long dp[1 << 7], tdp[1 << 7], pre;
void solve(long long x, long long times) {
  vector<vector<long long> > mat((1 << x), vector<long long>((1 << x), 0));
  for (long long st = 0; st < (1 << x); st++) {
    for (long long ed = 0; ed < (1 << x); ed++) {
      for (long long bt = 0; bt < (1 << (x - 1)); bt++) {
        long long add = 1;
        for (long long j = 0; j < x; j++) {
          long long cnt = 0;
          if (bt & (1 << j) || j == x - 1) cnt++;
          if (j == 0 || (bt & (1 << (j - 1)))) cnt++;
          if (st & (1 << j)) cnt++;
          if (ed & (1 << j)) cnt++;
          if (cnt == 4) add = 0;
        }
        if (add) mat[st][ed]++;
        if (mat[st][ed] >= mod) mat[st][ed] -= mod;
      }
    }
  }
  mat = Pow(mat, times);
  memset(tdp, 0, sizeof tdp);
  long long or_mask = 0;
  for (long long i = pre; i < x; i++) or_mask |= (1 << i);
  for (long long i = 0; i < (1 << x); i++) {
    for (long long j = 0; j < (1 << x); j++) {
      tdp[j] += dp[i] * mat[i | or_mask][j];
      tdp[j] %= mod;
    }
  }
  memcpy(dp, tdp, sizeof tdp);
  pre = x;
}
signed main() {
  for (long long i = 1; i <= 7; i++) cin >> w[i];
  for (long long i = 1; i <= 7; i++) {
    if (w[i]) {
      dp[(1 << i) - 1] = 1;
      break;
    }
  }
  for (long long i = 1; i <= 7; i++) {
    if (w[i]) {
      solve(i, w[i]);
    }
  }
  for (long long i = 7; i >= 1; i--) {
    if (w[i]) {
      cout << dp[(1 << i) - 1] << endl;
      return 0;
    }
  }
  return 0;
}
