#include <bits/stdc++.h>
using namespace std;
int siz;
struct mat {
  long long a[130][130];
  mat() { memset(a, 0, sizeof(a)); }
  mat operator*(const mat b) {
    mat c;
    for (int i = (0); i <= (siz); i++)
      for (int j = (0); j <= (siz); j++)
        for (int k = (0); k <= (siz); k++)
          (c.a[i][j] += a[i][k] * b.a[k][j] % 1000000007) %= 1000000007;
    return c;
  }
} ans, tmp;
int w[8];
int main() {
  for (int i = (1); i <= (7); i++) cin >> w[i];
  for (int i = (0); i <= (130 - 1); i++)
    for (int j = (0); j <= (130 - 1); j++) ans.a[i][i] = 1;
  for (int p = (1); p <= (7); p++) {
    siz = (1 << p) - 1;
    for (int i = (0); i <= (siz); i++)
      for (int j = (0); j <= (siz); j++) tmp.a[i][j] = 0;
    for (int i = (0); i <= (siz); i++)
      for (int j = (0); j <= (siz); j++)
        for (int k = (0); k <= (siz / 2 + 1); k++)
          tmp.a[i][j] += ((i | j | k | k * 2) == siz);
    for (; w[p]; w[p] >>= 1) {
      if (w[p] & 1) ans = ans * tmp;
      tmp = tmp * tmp;
    }
  }
  cout << ans.a[0][0] << endl;
  return 0;
}
