#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int x = 0, f = 0;
  char ch = getchar();
  for (; ch < '0' || ch > '9'; ch = getchar())
    if (ch == '-') f = 1;
  for (; ch >= '0' && ch <= '9'; ch = getchar())
    x = (x << 1) + (x << 3) + ch - 48;
  return f ? -x : x;
}
int a[7], b[7], m;
struct mat {
  long long a[128][128];
  mat() { memset(a, 0, sizeof a); }
  friend mat operator*(mat a, mat b) {
    mat c;
    for (int i = 0; i <= m; i++)
      for (int j = 0; j <= m; j++)
        for (int k = 0; k <= m; k++)
          c.a[i][j] =
              (c.a[i][j] + a.a[i][k] * b.a[k][j] % 1000000007) % 1000000007;
    return c;
  }
} A, B;
inline long long solve(int l, int r, int x) {
  if (!x) return l | r;
  long long sum = 0;
  for (int i = 0; i < 1 << x; i++) {
    long long ans = 1;
    for (int j = 0; j <= x; j++)
      ans &= (j == 0 ? 0 : (i >> (j - 1) & 1)) || (j == x ? 0 : (i >> j & 1)) ||
             (l >> j & 1) || (r >> j & 1);
    sum += ans;
  }
  return sum;
}
int main() {
  for (int i = 0; i <= 6; i++) a[i] = b[i] = read();
  B.a[0][0] = 1;
  for (int i = 0; i <= 6; i++)
    if (a[i]) {
      memset(A.a, 0, sizeof A.a);
      m = (1 << (i + 1)) - 1;
      for (int S = 0; S <= (1 << (i + 1)) - 1; S++)
        for (int T = 0; T <= (1 << (i + 1)) - 1; T++)
          A.a[S][T] = solve(S, T, i);
      while (a[i]) {
        if (a[i] & 1) B = B * A;
        a[i] >>= 1;
        if (a[i]) A = A * A;
      }
    }
  cout << B.a[0][0] << endl;
  return 0;
}
