#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long a[3], b[3], v[7];
  for (long long int i = 0; i < 3; i++) cin >> a[i];
  for (long long int i = 0; i < 3; i++) cin >> b[i];
  for (long long int i = 1; i < 7; i++) cin >> v[i];
  long long ans = 0;
  for (long long int i = 0; i < 3; i++) {
    if (a[i] >= 0 && a[i] <= b[i])
      continue;
    else if (a[i] < 0) {
      if (i == 0)
        ans += v[5];
      else if (i == 1)
        ans += v[1];
      else
        ans += v[3];
    } else {
      if (i == 0)
        ans += v[6];
      else if (i == 1)
        ans += v[2];
      else
        ans += v[4];
    }
  }
  cout << ans;
  return;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int TESTS = 1;
  while (TESTS--) {
    solve();
  }
  cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
  return 0;
}
