#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
const long long int maxn = (1 << 7) + 16, md = 1e9 + 7, inf = 2e18;
long long int tav(long long int n, long long int k) {
  long long int res = 1;
  while (k > 0) {
    if (k & 1) {
      res *= n;
      res %= md;
    }
    n *= n;
    n %= md;
    k >>= 1;
  }
  return res;
}
struct matrix {
  long long int n, m;
  long long int a[maxn][maxn];
  void init(long long int x, long long int y) {
    n = x;
    m = y;
    return;
  }
  void build(vector<vector<long long int>> &z) {
    for (long long int i = 0; i < n; i++) {
      for (long long int j = 0; j < m; j++) {
        a[i][j] = z[i][j];
      }
    }
    return;
  }
  void def(bool k) {
    memset(a, 0, sizeof(a));
    if (k)
      for (long long int i = 0; i < n; i++) a[i][i] = 1;
    return;
  }
  friend matrix operator*(matrix a, matrix b) {
    matrix res;
    res.init(a.n, b.m);
    res.def(0);
    long long int n = a.n;
    for (long long int i = 0; i < n; i++) {
      for (long long int j = 0; j < n; j++) {
        for (long long int k = 0; k < n; k++) {
          res.a[i][j] += 1ll * a.a[i][k] * b.a[k][j] % md;
          if (res.a[i][j] >= md) res.a[i][j] -= md;
        }
      }
    }
    return res;
  }
  friend void operator*=(matrix &a, matrix b) {
    a = a * b;
    return;
  }
  friend matrix operator^(matrix a, long long int k) {
    matrix res;
    res.init(a.n, a.n);
    res.def(1);
    long long int n = a.n;
    while (k > 0) {
      if (k & 1) {
        res *= a;
      }
      a *= a;
      k >>= 1;
    }
    return res;
  }
  friend void operator^=(matrix &a, long long int k) {
    a = a ^ k;
    return;
  }
};
vector<vector<long long int>> z[7], h;
matrix a[7], x;
matrix ans, tmp;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  for (long long int e = 0; e < 7; e++) {
    long long int lm = 1 << (e + 1);
    z[e].resize(lm);
    for (long long int mask = 0; mask < lm; mask++) {
      z[e][mask].resize(lm);
      for (long long int ksam = 0; ksam < lm; ksam++) {
        long long int f = 0, g = 1;
        for (long long int j = e; j >= 0; j--) {
          long long int a = f, b = g;
          f = g + f;
          g = f;
          if (!(mask & (1 << j)) & !(ksam & (1 << j))) g = a;
        }
        z[e][mask][ksam] = g;
      }
    }
    a[e].init(lm, lm);
    a[e].build(z[e]);
  }
  for (long long int i = 0; i < 7; i++) {
    long long int k;
    cin >> k;
    a[i] ^= k;
  }
  long long int lm = 1 << 7;
  ans.init(lm, lm);
  ans.def(1);
  h.resize(lm);
  for (long long int i = 0; i < lm; i++) h[i].assign(lm, 0);
  for (long long int i = 0; i < 7; i++) {
    long long int q = 1 << (i + 1);
    for (long long int j = 0; j < q; j++) {
      for (long long int k = 0; k < q; k++) {
        h[j][k] = a[i].a[j][k];
      }
    }
    tmp.init(lm, lm);
    tmp.build(h);
    ans *= tmp;
  }
  cout << ans.a[0][0] << '\n';
  return 0;
}
