#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
vector<pair<int, int> > vec;
int main() {
  int w[8];
  for (int i = 1; i <= 7; i++) {
    scanf("%d", &w[i]);
    if (w[i]) vec.push_back({i, w[i]});
  }
  vector<vector<vector<int> > > dp, tmp;
  int bef = 0;
  for (auto x : vec) {
    if (dp.size() == 0) {
      bef = x.first;
      dp.assign(7, vector<vector<int> >(1 << 7, vector<int>(2)));
      dp[0][(1 << x.first) - 1][1] = 1;
    } else {
      int bit = 0;
      for (int i = bef; i < x.first; i++) bit += (1 << i);
      for (int j = 0; j < (1 << bef); j++) {
        dp[0][j | bit][1] = dp[0][j][1];
        dp[0][j][1] = 0;
      }
      bef = x.first;
    }
    if (x.first == 1) {
      vector<vector<int> > dp1(x.second + 1, vector<int>(2));
      dp1[0][1] = 1;
      for (int i = 1; i <= x.second; i++) {
        dp1[i][0] = ((dp1[i - 1][0] + dp1[i - 1][1]) % MOD);
        dp1[i][1] = dp1[i - 1][0];
      }
      dp[0][0][1] = dp1[x.second][0];
      dp[0][1][1] = dp1[x.second][1];
      continue;
    }
    for (int i = 0; i < x.second; i++) {
      for (int j = 0; j < x.first; j++) {
        for (int k = 0; k < (1 << x.first); k++) {
          int bit = (1 << j);
          int nbit = (~bit);
          if (j == x.first - 1) {
            dp[0][k & nbit][1] = ((dp[0][k & nbit][1] + dp[j][k][0]) % MOD);
            dp[0][k & nbit][1] = ((dp[0][k & nbit][1] + dp[j][k][1]) % MOD);
            dp[0][k | bit][1] = ((dp[0][k | bit][1] + dp[j][k][0]) % MOD);
            if (!(k & bit))
              dp[0][k | bit][1] = ((dp[0][k | bit][1] + dp[j][k][1]) % MOD);
          } else {
            dp[j + 1][k & nbit][0] =
                ((dp[j + 1][k & nbit][0] + dp[j][k][0]) % MOD);
            dp[j + 1][k & nbit][0] =
                ((dp[j + 1][k & nbit][0] + dp[j][k][1]) % MOD);
            dp[j + 1][k | bit][0] =
                ((dp[j + 1][k | bit][0] + dp[j][k][0]) % MOD);
            dp[j + 1][k | bit][0] =
                ((dp[j + 1][k | bit][0] + dp[j][k][1]) % MOD);
            dp[j + 1][k & nbit][1] =
                ((dp[j + 1][k & nbit][1] + dp[j][k][0]) % MOD);
            dp[j + 1][k & nbit][1] =
                ((dp[j + 1][k & nbit][1] + dp[j][k][1]) % MOD);
            dp[j + 1][k | bit][1] =
                ((dp[j + 1][k | bit][1] + dp[j][k][0]) % MOD);
            if (!(k & bit))
              dp[j + 1][k | bit][1] =
                  ((dp[j + 1][k | bit][1] + dp[j][k][1]) % MOD);
          }
          dp[j][k][0] = dp[j][k][1] = 0;
        }
      }
    }
  }
  printf("%d\n", dp[0][(1 << vec.back().first) - 1][1]);
}
