#include <bits/stdc++.h>
int faster_in() {
  int r = 0, c;
  for (c = getchar(); c <= 32; c = getchar())
    ;
  if (c == '-') return -faster_in();
  for (; c > 32; r = (r << 1) + (r << 3) + c - '0', c = getchar())
    ;
  return r;
}
using namespace std;
const int INF = int(1e9 + 7);
const double PI = acos(-1);
const int MOD = 1e9 + 7;
int vmat[19][1 << 8][1 << 8];
int cant[19];
void init(int limit) {
  for (int middle = (int)0; middle < (int)(1 << (limit + 1)); middle++) {
    if ((middle & 1) == 0 || (middle & (1 << limit)) == 0) continue;
    for (int maski = (int)0; maski < (int)(1 << limit); maski++) {
      for (int maskj = (int)0; maskj < (int)1 << limit; maskj++) {
        bool no = 0;
        for (int pos = (int)0; pos < (int)limit; pos++) {
          if (((1 << pos) & maski) && ((1 << pos) & maskj) &&
              (middle & (1 << pos)) && (middle & (1 << (pos + 1))))
            no = 1;
        }
        if (!no) vmat[limit][maski][maskj]++;
      }
    }
  }
}
vector<int> transform(vector<int> act, int antlim, int limit) {
  int agregar = 0;
  for (int i = (int)antlim; i < (int)limit; i++) agregar += 1 << i;
  vector<int> nuevo(1 << limit, 0);
  for (int i = (int)0; i < (int)act.size(); i++) nuevo[i + agregar] = act[i];
  return nuevo;
}
vector<vector<int> > ans;
void mult(vector<vector<int> > &m1, vector<vector<int> > &m2) {
  if (m1[0].size() != m2.size()) assert(false);
  ans.clear();
  long long answer = 0;
  for (int i = (int)0; i < (int)m1.size(); i++) {
    vector<int> fila;
    for (int j = (int)0; j < (int)m2[0].size(); j++) {
      answer = 0;
      for (int k = (int)0; k < (int)m2.size(); k++) {
        answer += ((long long)(m1[i][k] % MOD) * (m2[k][j] % MOD)) % MOD;
        while (answer >= MOD) answer -= MOD;
      }
      fila.push_back(answer);
    }
    ans.push_back(fila);
  }
}
vector<vector<int> > pot(vector<vector<int> > &base, int exp) {
  int n = base.size();
  vector<vector<int> > res(n, vector<int>(n, 0));
  for (int i = (int)0; i < (int)n; i++) res[i][i] = 1;
  while (exp) {
    if (exp & 1) {
      mult(res, base);
      res = ans;
    }
    mult(base, base);
    base = ans;
    exp /= 2;
  }
  return res;
}
int main() {
  for (int i = (int)1; i < (int)8; i++) {
    init(i);
  }
  int primer = -1;
  for (int i = (int)1; i < (int)8; i++) {
    cin >> cant[i];
    if (cant[i] > 0 && primer == -1) primer = i;
  }
  vector<vector<int> > respuesta(1, vector<int>(1 << primer, 0));
  respuesta[0][(1 << primer) - 1] = 1;
  int ant = primer, finalanswer = 0;
  for (int i = (int)1; i < (int)8; i++) {
    if (cant[i] > 0) {
      if (ant != i) respuesta[0] = transform(respuesta[0], ant, i);
      vector<vector<int> > base((1 << i), vector<int>(1 << i, 0));
      for (int j = (int)0; j < (int)(1 << i); j++)
        for (int k = (int)0; k < (int)(1 << i); k++) base[j][k] = vmat[i][j][k];
      base = pot(base, cant[i]);
      mult(respuesta, base);
      respuesta = ans;
      finalanswer = respuesta[0][respuesta[0].size() - 1];
      ant = i;
    }
  }
  cout << finalanswer << endl;
}
