#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
bool dzn(char k) {
  if (k == 'a' || k == 'o' || k == 'i' || k == 'u' || k == 'e') return true;
  return false;
}
const int N = 128;
struct matrix {
  int n, m;
  long long a[N + 5][N + 5];
  matrix(int _n, int _m) : n(_n), m(_m) {}
  matrix operator*(matrix other) {
    matrix ans(n, other.m);
    for (int i = 0; i < (ans.n); ++i) {
      for (int j = 0; j < (ans.m); ++j) {
        ans.a[i][j] = 0;
        for (int k = 0; k < (m); ++k) {
          ans.a[i][j] += (a[i][k] * other.a[k][j]) % MOD;
          ans.a[i][j] %= MOD;
        }
      }
    }
    return ans;
  }
};
long long dp[8][2];
long long solve(int h, int m1, int m2) {
  dp[0][0] = 0;
  dp[0][1] = 1;
  for (long long i = (1); i <= (h); ++i) {
    dp[i][0] = dp[i - 1][0] + dp[i - 1][1];
    dp[i][1] = dp[i - 1][0];
    if (!(m1 & (1 << (i - 1)) && m2 & (1 << (i - 1)))) {
      dp[i][1] = dp[i][0];
    }
  }
  return dp[h][1];
}
int main() {
  ios_base::sync_with_stdio(false);
  matrix ans(1, 2);
  ans.a[0][1] = 1;
  for (int i = 0; i < (7); ++i) {
    matrix tv((1 << (i + 1)), (1 << (i + 1)));
    int w;
    cin >> w;
    for (long long m1 = (N - (1 << (i + 1))); m1 <= (N - 1); ++m1) {
      for (long long m2 = (N - (1 << (i + 1))); m2 <= (N - 1); ++m2) {
        tv.a[m1 - N + (1 << (i + 1))][m2 - N + (1 << (i + 1))] =
            solve(i + 1, m1, m2);
      }
    }
    for (int as = 0; as < (17); ++as) {
      if (w & (1 << as)) ans = ans * tv;
      tv = tv * tv;
    }
    matrix nw(1, (1 << (i + 2)));
    for (int in = 0; in < ((1 << (i + 2))); ++in) {
      if (in < (1 << (i + 1)))
        nw.a[0][in] = 0;
      else
        nw.a[0][in] = ans.a[0][in - (1 << (i + 1))];
    }
    ans = nw;
  }
  cout << ans.a[0][ans.m - 1] << endl;
  return 0;
}
