#include <bits/stdc++.h>
const int p = 1000000007;
struct matrix {
  int g[128][128];
};
matrix basic[10], emp, tmp, result;
int h, i, j, k, l, s, t;
bool b;
inline void matrixmul(matrix x, matrix y) {
  memset(result.g, 0, sizeof(result.g));
  for (int i = 0; i < 128; i++)
    for (int k = 0; k < 128; k++)
      if (x.g[i][k])
        for (int j = 0; j < 128; j++)
          result.g[i][j] = (result.g[i][j] + 1LL * x.g[i][k] * y.g[k][j]) % p;
  return;
}
inline void buildfirstmatrix() {
  result.g[0][0] = 1;
  for (i = 0; i < 128; i++) emp.g[i][i] = 1;
  for (h = 1; h <= 7; h++)
    for (i = 0; i < (1 << h); i++)
      for (j = 0; j < (1 << h); j++)
        for (k = 0; k < (1 << (h + 1)); k++)
          if (!((k & 1) || (k & (1 << h)))) {
            b = true;
            for (l = 0; l < h; l++)
              if (!(((1 << l) & k) || ((1 << (l + 1)) & k) || ((1 << l) & i) ||
                    ((1 << l) & j)))
                b = false;
            if (b) basic[h].g[i][j]++;
          }
  return;
}
inline void matrixpower(int m) {
  if (!m)
    result = emp;
  else {
    matrixpower(m / 2);
    matrixmul(result, result);
    if (m & 1) matrixmul(result, basic[i]);
  }
  return;
}
inline void getans() {
  for (i = 1; i <= 7; i++) {
    scanf("%d", &t);
    tmp = result;
    matrixpower(t);
    matrixmul(tmp, result);
  }
  printf("%d", result.g[0][0]);
  return;
}
int main() {
  buildfirstmatrix();
  getans();
  return 0;
}
