#include <bits/stdc++.h>
using namespace std;
const int N = 128;
const int P = 1000000007;
int dp[N][8][2];
int ans[N][N], tmp[N][N], mul[N][N];
int main() {
  for (int i = 0; i <= N - 1; i++) {
    dp[i][0][0] = 0;
    dp[i][0][1] = 1;
    for (int j = 1; j <= 7; j++) {
      dp[i][j][0] = dp[i][j - 1][0] + dp[i][j - 1][1];
      if ((i >> (j - 1)) & 1)
        dp[i][j][1] = dp[i][j - 1][0];
      else
        dp[i][j][1] = dp[i][j][0];
    }
  }
  ans[0][0] = 1;
  for (int c = 1; c <= 7; c++) {
    int val;
    cin >> val;
    int M = (1 << c) - 1;
    for (int i = 0; i <= M / 2; i++)
      ans[0][M / 2 + 1 + i] = ans[0][i], ans[0][i] = 0;
    for (int i = 0; i <= M; i++)
      for (int j = 0; j <= M; j++) mul[i][j] = dp[i & j][c][1];
    for (; val; val >>= 1) {
      if (val & 1) {
        for (int i = 0; i <= M; i++)
          for (int j = 0; j <= M; j++) tmp[i][j] = 0;
        for (int i = 0; i <= M; i++)
          for (int j = 0; j <= M; j++)
            for (int k = 0; k <= M; k++) {
              tmp[i][k] = (tmp[i][k] + (long long)ans[i][j] * mul[j][k]) % P;
            }
        for (int i = 0; i <= M; i++)
          for (int j = 0; j <= M; j++) ans[i][j] = tmp[i][j];
      }
      for (int i = 0; i <= M; i++)
        for (int j = 0; j <= M; j++) tmp[i][j] = 0;
      for (int i = 0; i <= M; i++)
        for (int j = 0; j <= M; j++)
          for (int k = 0; k <= M; k++) {
            tmp[i][k] = (tmp[i][k] + (long long)mul[i][j] * mul[j][k]) % P;
          }
      for (int i = 0; i <= M; i++)
        for (int j = 0; j <= M; j++) mul[i][j] = tmp[i][j];
    }
  }
  cout << ans[0][N - 1] << endl;
  return 0;
}
