#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
int M = 128;
long long MOD = 1e9 + 7;
int n, w[10];
int mul(int a, int b) { return (1ll * a * b) % MOD; }
int add(int a, int b) { return (a + b) % MOD; }
struct matrix {
  int mat[1 << 7][1 << 7];
  matrix() {
    for (int i = 0; i < M; i++) {
      for (int j = 0; j < M; j++) {
        mat[i][j] = 0;
      }
    }
  }
  matrix(int x) {
    for (int i = 0; i < M; i++) {
      for (int j = 0; j < M; j++) {
        mat[i][j] = 0;
      }
      mat[i][i] = 1;
    }
  }
  int* operator[](int i) { return mat[i]; }
  matrix operator*(matrix m) {
    matrix MAT;
    for (int i = 0; i < M; i++) {
      for (int j = 0; j < M; j++) {
        for (int k = 0; k < M; k++) {
          MAT[i][k] = add(MAT[i][k], mul(mat[i][j], m[j][k]));
        }
      }
    }
    return MAT;
  }
};
matrix fast_matrix(matrix mat, long long x) {
  matrix m(1);
  while (x) {
    if (x & 1) m = m * mat;
    mat = mat * mat;
    x >>= 1;
  }
  return m;
}
bool lef[10], rit[10], hor[10];
int main() {
  for (int i = 1; i <= 7; i++) {
    scanf("%d", w + i);
  }
  matrix a;
  a[0][127] = 1;
  for (int h = 7; h >= 1; h--) {
    matrix mat;
    if (w[h])
      for (int l = 0; l < (1 << h); l++) {
        for (int r = 0; r < (1 << h); r++) {
          for (int mid = 0; mid < (1 << (h - 1)); mid++) {
            for (int i = 0; i < h; i++) {
              lef[i] = (l >> i) & 1;
              rit[i] = (r >> i) & 1;
              if (i) hor[i] = (mid >> (i - 1)) & 1;
            }
            hor[0] = hor[h] = 1;
            bool valid = 1;
            for (int i = 0; i < h; i++) {
              if (lef[i] and rit[i] and hor[i] and hor[i + 1]) {
                valid = 0;
                break;
              }
            }
            if (valid) mat[l][r]++;
          }
        }
      }
    if (w[h]) {
      mat = fast_matrix(mat, w[h]);
      a = a * mat;
    }
    for (int i = 0; i < (1 << (h - 1)); i++) {
      a[0][i] = a[0][i | (1 << (h - 1))];
    }
    M >>= 1;
  }
  printf("%d\n", a[0][1]);
}
