#include <bits/stdc++.h>
const int N = 7, M = 1000000007;
typedef int Mat[1 << N][1 << N];
int m;
Mat X, A, T;
void mult(Mat &X, Mat &LX, Mat &ans) {
  for (int i = 0; i < m; i++)
    for (int j = 0; j < m; j++) {
      T[i][j] = 0;
      for (int k = 0; k < m; k++)
        T[i][j] = (T[i][j] + (long long)X[i][k] * LX[k][j]) % M;
    }
  for (int i = 0; i < m; i++)
    for (int j = 0; j < m; j++) ans[i][j] = T[i][j];
}
int main() {
  for (int i = 0; i < 1 << N; i++) A[i][i] = 1;
  for (int w, p = 1, i, j, k; p <= 7; p++) {
    scanf("%d", &w);
    m = 1 << p;
    for (i = 0; i < m; i++)
      for (j = 0; j < m; j++)
        for (k = X[i][j] = 0; k < m >> 1; k++)
          X[i][j] += ((i | j | k | k << 1) == m - 1);
    for (; w; w >>= 1, mult(X, X, X))
      if (w & 1) mult(A, X, A);
  }
  printf("%d\n", A[0][0]);
  return 0;
}
