#include <bits/stdc++.h>
using namespace std;
const int N = 129, Mod = 1e9 + 7;
struct Matrix {
  int n, m, A[N][N];
  inline Matrix(int _n, int _m) : n(_n), m(_m) { memset(A, 0, sizeof(A)); }
  inline Matrix operator*(Matrix &X) {
    Matrix R(n, X.m);
    for (int i = 0; i < n; i++)
      for (int j = 0; j < m; j++)
        for (int k = 0; k < X.m; k++)
          R[i][k] = (R[i][k] + 1LL * A[i][j] * X[j][k]) % Mod;
    return (R);
  }
  inline Matrix operator^(long long pw) {
    Matrix R(n, n), T = *this;
    for (int i = 0; i < n; i++) R[i][i] = 1;
    for (; pw; pw >>= 1, T = T * T)
      if (pw & 1) R = R * T;
    return (R);
  }
  inline int *operator[](int i) { return A[i]; }
};
int main() {
  Matrix dp(1, 1);
  dp[0][0] = 1;
  for (int h = 1; h <= 7; h++) {
    int n = 1 << h;
    Matrix M(n, n);
    for (int i = 0; i < n; i++)
      for (int j = 0; j < n; j++)
        for (int k = 0; k < (n >> 1); k++) {
          bool Fail = 0;
          int kk = (k << 1) | n | 1;
          for (int l = 0; l < h; l++)
            if ((i >> l & 1) && (j >> l & 1) && (kk >> l & 1) &&
                (kk >> (l + 1) & 1))
              Fail = 1;
          if (!Fail) M[i][j]++;
        }
    Matrix dpt(1, n);
    for (int i = 0; i < (n >> 1); i++) dpt[0][(n >> 1) + i] = dp[0][i];
    dp = dpt;
    int val;
    scanf("%d", &val);
    M = M ^ val;
    dp = dp * M;
  }
  return !printf("%d", dp[0][127]);
}
