#include <bits/stdc++.h>
using namespace std;
const int mo = 1000000007;
int t[129][129], a[129][129], n;
void multi(int a[129][129], int b[129][129], int n) {
  int c[129][129];
  memset(c, 0, sizeof(c));
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < n; ++j)
      for (int k = 0; k < n; ++k)
        c[i][k] = (c[i][k] + 1ll * a[i][j] * b[j][k]) % mo;
  memcpy(a, c, sizeof(c));
}
int main() {
  a[1][1] = 1;
  for (int i = 1; i <= 7; ++i) {
    scanf("%d", &n);
    memset(t, 0, sizeof(t));
    for (int j = 0; j < 1 << i; ++j)
      for (int k = 0; k < 1 << i; ++k)
        for (int z = 0; z < 1 << i - 1; ++z) {
          int tmp = (z << 1) | 1 | (1 << i);
          if (j & k & tmp & (tmp >> 1)) continue;
          t[j][k]++;
        }
    while (n) {
      if (n & 1) multi(a, t, 1 << i);
      multi(t, t, 1 << i);
      n /= 2;
    }
    if (i != 7) {
      for (int j = 0; j < 1 << i; ++j) a[1][j | 1 << i] = a[1][j], a[1][j] = 0;
    }
  }
  printf("%d\n", a[1][127]);
}
