#include <bits/stdc++.h>
using namespace std;
const int M = (1 << 7) - 1;
const int md = 1e9 + 7;
int n, mx;
struct mt {
  long long a[168][168];
  mt() { memset(a, 0, sizeof(a)); }
  mt operator*(const mt &k) {
    mt rs;
    for (int i = (0); i <= (mx); i++)
      for (int j = (0); j <= (mx); j++)
        for (int l = (0); l <= (mx); l++)
          rs.a[i][j] = (rs.a[i][j] + a[i][l] * k.a[l][j] % md) % md;
    return rs;
  }
} a, e;
void msk(mt a, int b, mt &k) {
  while (b) {
    if (b & 1) k = k * a;
    b >>= 1;
    a = a * a;
  }
}
int main() {
  for (int i = (0); i <= (M); i++) a.a[i][i] = 1;
  for (int w = (1); w <= (7); w++) {
    int x;
    mx = (1 << w) - 1;
    scanf("%d", &x);
    for (int i = (0); i <= (mx); i++)
      for (int j = (0); j <= (mx); j++) {
        e.a[i][j] = 0;
        for (int k = (0); k <= (mx / 2 + 1); k++)
          e.a[i][j] += ((i | j | k | k * 2) == mx);
      }
    msk(e, x, a);
  }
  printf("%lld", a.a[0][0]);
}
