#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
int dx[] = {0, 0, -1, 1};
int dy[] = {-1, 1, 0, 0};
int n;
bool mset(int mask, int i) { return mask & (1 << i); }
bool sparse(int k, int left, int horizontal, int right) {
  for (int i = (0); i < (k); ++i)
    if (mset(left, i) && mset(right, i) && mset(horizontal, i) &&
        mset(horizontal, i + 1))
      return 0;
  return 1;
}
int ways(int k, int left, int right) {
  int c = 0;
  for (int horizontal = (0); horizontal < ((1 << (k - 1))); ++horizontal)
    if (sparse(k, left, 2 * horizontal + 1 + (1 << k), right)) ++c;
  return c;
}
int dp[133];
int tmp[133];
int size;
int matrix[7][128][128];
void diag(int a, int s = 1) {
  for (int i = (0); i < (size); ++i)
    for (int j = (0); j < (size); ++j) matrix[a][i][j] = (i == j ? s : 0);
}
void mov(int a, int b) {
  for (int i = (0); i < (size); ++i)
    for (int j = (0); j < (size); ++j) matrix[b][i][j] = matrix[a][i][j];
}
void mul(int a, int b, int c) {
  diag(c, 0);
  for (int i = (0); i < (size); ++i)
    for (int k = (0); k < (size); ++k)
      for (int j = (0); j < (size); ++j)
        matrix[c][i][j] =
            (matrix[c][i][j] + (long long)matrix[a][i][k] * matrix[b][k][j]) %
            mod;
}
void pow(int k) {
  diag(1);
  while (k) {
    if (k & 1) {
      mul(0, 1, 2);
      mov(2, 1);
    }
    mul(0, 0, 2);
    mov(2, 0);
    k /= 2;
  }
}
void process(int k, int w) {
  size = (1 << k);
  for (int i = (0); i < (size / 2); ++i) {
    dp[i + size / 2] = dp[i];
    dp[i] = 0;
  }
  for (int i = (0); i < (size); ++i)
    for (int j = (0); j < (size); ++j) matrix[0][i][j] = ways(k, i, j);
  pow(w);
  for (int i = (0); i < (size); ++i) tmp[i] = 0;
  for (int i = (0); i < (size); ++i)
    for (int j = (0); j < (size); ++j)
      tmp[j] = (tmp[j] + (long long)dp[i] * matrix[1][i][j]) % mod;
  for (int i = (0); i < (size); ++i) dp[i] = tmp[i];
}
int main() {
  dp[0] = 1;
  for (int k = (1); k < (8); ++k) {
    int w;
    scanf("%d", &w);
    process(k, w);
  }
  printf("%d\n", dp[127]);
  return 0;
}
