#include <bits/stdc++.h>
const int N = 7;
int wide[N + 1];
const unsigned int mod = 1000000007u;
class TransMat {
 public:
  unsigned int num[1 << N][1 << N];
  int n;

 public:
  void clear();
};
void TransMat ::clear() { memset(num, 0, sizeof num); }
class AnsMat {
 public:
  unsigned int num[1 << N];
  int n;

 public:
  void clear();
};
void AnsMat ::clear() { memset(num, 0, sizeof num); }
TransMat operator*(const TransMat &a, const TransMat &b) {
  TransMat c;
  c.clear();
  c.n = a.n;
  int S = 1 << c.n;
  for (int i = 0; i < S; ++i)
    for (int j = 0; j < S; ++j)
      for (int k = 0; k < S; ++k)
        c.num[i][j] =
            (c.num[i][j] + (unsigned long long)a.num[i][k] * b.num[k][j]) % mod;
  return c;
}
AnsMat operator*(const TransMat &a, const AnsMat &b) {
  AnsMat c;
  c.clear();
  c.n = b.n;
  int S = 1 << c.n;
  for (int i = 0; i < S; ++i)
    for (int k = 0; k < S; ++k)
      c.num[i] = (c.num[i] + (unsigned long long)a.num[i][k] * b.num[k]) % mod;
  return c;
}
TransMat Trans;
AnsMat f;
void read() {
  for (int i = 1; i <= N; ++i) scanf("%d", &wide[i]);
}
void GetTrans(int n) {
  Trans.clear();
  Trans.n = n;
  int S = 1 << n;
  for (int t = 0; t < S; ++t)
    for (int s = 0; s < S; ++s)
      for (int mid = S >> 1; mid < S; ++mid)
        Trans.num[t][s] += !(t & s & mid & (mid << 1) || (t & s & mid & 1));
}
void fupdate(int n) {
  f.n = n;
  int S = 1 << n, hS = S >> 1;
  for (int s = hS; s < S; ++s) f.num[s] = f.num[s - hS], f.num[s - hS] = 0;
}
void qpower(int b) {
  for (; b; Trans = Trans * Trans, b >>= 1)
    if (b & 1) f = Trans * f;
}
void chief() {
  f.num[0] = 1;
  f.n = 0;
  for (int i = 1; i <= N; ++i) {
    GetTrans(i);
    fupdate(i);
    qpower(wide[i]);
  }
}
void write() { printf("%u\n", f.num[(1 << N) - 1]); }
int main() {
  read();
  chief();
  write();
  return 0;
}
