#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9 + 322;
const long long LINF = 2e18 + 474;
const int N = 1e5 + 7;
const int MOD = 1e9 + 7;
const double eps = 1e-14;
int facets[7], ans = 0;
int a, b, c, x, y, z;
void solve() {
  cin >> a >> b >> c >> x >> y >> z;
  for (int i = 1; i < 7; i++) cin >> facets[i];
  if (b < 0) ans += facets[1];
  if (b > y) ans += facets[2];
  if (c < 0) ans += facets[3];
  if (c > z) ans += facets[4];
  if (a < 0) ans += facets[5];
  if (a > x) ans += facets[6];
  cout << ans;
}
int main() {
  if (!1) {
    freopen(
        "substrcmp"
        ".in",
        "r", stdin);
    freopen(
        "substrcmp"
        ".out",
        "w", stdout);
  }
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  setlocale(LC_ALL, "Russian");
  int T = 1;
  while (T--) solve();
  return 0;
}
