#include <bits/stdc++.h>
using namespace std;
const int BASE = 1e9 + 7;
const int N = 8;
int n = 7;
int w[N];
long long dp[N][1 << N], f[N][1 << N];
struct Matrix {
  static const int N = (1 << 7) + 10;
  int n;
  long long a[N][N];
  void Init(int _n) {
    n = _n;
    for (int i = 0; i < n; ++i)
      for (int j = 0; j < n; ++j) a[i][j] = 0;
  }
  Matrix operator*(const Matrix &that) const {
    Matrix ans;
    ans.Init(n);
    for (int i = 0; i < n; ++i)
      for (int j = 0; j < n; ++j)
        for (int k = 0; k < n; ++k)
          ans.a[i][j] = (ans.a[i][j] + a[i][k] * that.a[k][j]) % BASE;
    return ans;
  }
};
void Add(long long &a, long long b) {
  a += b;
  a %= BASE;
}
long long Compute(int n, int mask1, int mask2) {
  static long long ways[N][2];
  memset(ways, 0, sizeof ways);
  ways[0][1] = 1;
  for (int i = 1; i <= n; ++i) {
    int bit1 = mask1 >> (i - 1) & 1, bit2 = mask2 >> (i - 1) & 1;
    if (bit1 == 1 && bit2 == 1) {
      Add(ways[i][1], ways[i - 1][0]);
      Add(ways[i][0], ways[i - 1][0]);
      Add(ways[i][0], ways[i - 1][1]);
    } else {
      for (int x = 0; x <= 1; ++x)
        for (int y = 0; y <= 1; ++y) Add(ways[i][x], ways[i - 1][y]);
    }
  }
  return ways[n][1];
}
Matrix Pow(Matrix a, long long p) {
  Matrix ans;
  ans = a;
  --p;
  while (p) {
    if (p & 1) ans = ans * a;
    a = a * a;
    p >>= 1;
  }
  return ans;
}
Matrix BuildMatrix(int n) {
  Matrix ans;
  ans.Init(1 << n);
  for (int i = 0; i < 1 << n; ++i)
    for (int j = 0; j < 1 << n; ++j) {
      ans.a[i][j] = Compute(n, i, j);
    }
  return ans;
}
int main() {
  for (int i = 1; i <= n; ++i) scanf("%d", &w[i]);
  dp[0][0] = 1;
  for (int i = 1; i <= n; ++i) {
    for (int preMask = 0; preMask < 1 << (i - 1); ++preMask)
      Add(f[i][preMask | (1 << (i - 1))], dp[i - 1][preMask]);
    if (w[i] == 0) {
      for (int mask = 0; mask < 1 << i; ++mask) dp[i][mask] = f[i][mask];
    } else {
      Matrix a = BuildMatrix(i);
      a = Pow(a, w[i]);
      for (int mask1 = 0; mask1 < 1 << i; ++mask1)
        for (int mask2 = 0; mask2 < 1 << i; ++mask2) {
          Add(dp[i][mask1], f[i][mask2] * a.a[mask2][mask1]);
        }
    }
  }
  printf("%I64d", dp[n][(1 << n) - 1]);
  return 0;
}
