#include <bits/stdc++.h>
using namespace std;
char _;
const int maxN = 400 + 5;
const int mod = 1000 * 1000 * 1000 + 7;
const int SQ = 317;
const int maxL = 20;
const int L = 1 << 7;
struct Mat {
  int n;
  int val[L][L];
  Mat(int fl = 0) {
    for (int i = 0; i < L; i++)
      for (int j = 0; j < L; j++)
        if (i != j)
          val[i][j] = 0;
        else
          val[i][j] = fl;
  }
} p[7];
Mat operator*(const Mat &p, const Mat &q) {
  Mat ans;
  ans.n = max(p.n, q.n);
  for (int i = 0; i < ans.n; i++)
    for (int j = 0; j < ans.n; j++)
      for (int k = 0; k < ans.n; k++)
        ans.val[i][j] =
            (ans.val[i][j] + (1LL) * p.val[i][k] * q.val[k][j] % mod) % mod;
  return ans;
}
Mat power(Mat q, int k) {
  Mat ans(1);
  ans.n = q.n;
  while (k) {
    if (k & 1) ans = ans * q;
    k >>= 1;
    q = q * q;
  }
  return ans;
}
void solve(int n) {
  p[n - 1].n = (1 << n);
  for (int mask = 0; mask < (1 << n); mask++)
    for (int smask = 0; smask < (1 << n); smask++)
      for (int bmask = 0; bmask < (1 << (n - 1)); bmask++) {
        bool fl = 1;
        for (int i = 0; i < n; i++) {
          bool x = mask >> i & 1;
          bool y = smask >> i & 1;
          bool z = (i ? (bmask >> (i - 1) & 1) : 0);
          bool w = bmask >> i & 1;
          if (x == 0 && y == 0 && z == 0 && w == 0) {
            fl = 0;
            break;
          }
        }
        if (fl) p[n - 1].val[mask][smask]++;
      }
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  for (int i = 1; i < 8; i++) solve(i);
  Mat ans;
  ans.n = L;
  ans.val[0][0] = 1;
  for (int i = 0; i < 7; i++) {
    int x;
    cin >> x;
    ans = ans * power(p[i], x);
  }
  cout << ans.val[0][0] << endl;
  return 0;
}
