#include <bits/stdc++.h>
using namespace std;
const int LOG = 7, N = (1 << LOG), MOD = 1000 * 1000 * 1000 + 7;
typedef int mat[N][N];
int w, last;
mat updater, ans, help;
int sum(int a, int b) {
  a += b;
  return (a >= MOD ? a - MOD : a);
}
int mul(int a, int b) {
  long long res = a;
  return res * b % MOD;
}
void memset(mat a) {
  for (int i = 0; i < N; i++)
    for (int j = 0; j < N; j++) a[i][j] = 0;
}
void mat_mul(mat a, mat b, int limit) {
  memset(help);
  for (int i = 0; i < N; i++)
    for (int j = 0; j < N; j++)
      for (int k = 0; k < limit; k++)
        help[i][k] = sum(help[i][k], mul(a[i][j], b[j][k]));
}
bool check(int a, int b, int c) {
  for (int i = 0; i < LOG; i++)
    if ((a & (1LL << i)) && (b & (1LL << i)) && (c & (1LL << i)) &&
        (c & (1LL << (i + 1))))
      return false;
  return true;
}
int main() {
  ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  bool first = true;
  for (int I = 1; I <= 7; I++) {
    cin >> w;
    if (w == 0) continue;
    if (first) {
      first = false;
      ans[(1 << I) - 1][0] = 1;
      last = I;
    } else {
      memset(help);
      for (int i = 0; i < (1 << I); i++) {
        bool add = true;
        int mask = i;
        for (int j = I - 1; j >= last; j--)
          if (mask & (1 << j))
            mask ^= (1 << j);
          else
            add = false;
        if (add) help[i][0] = ans[mask][0];
      }
      swap(ans, help);
    }
    memset(updater);
    for (int i = 0; i < (1 << I); i++)
      for (int j = 0; j < (1 << I); j++)
        for (int k = 0; k < (1 << (I + 1)); k++)
          if ((k & 1) && (k & (1 << (I))) && check(i, j, k)) updater[i][j]++;
    for (; w; w >>= 1) {
      if (w & 1) {
        mat_mul(updater, ans, 1);
        swap(ans, help);
      }
      mat_mul(updater, updater, N);
      swap(updater, help);
    }
    last = I;
  }
  cout << ans[(1 << last) - 1][0];
  return 0;
}
