#include <bits/stdc++.h>
using namespace std;
const long long N = 200005;
const long long M = 999997489;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long A[3], B[3], C[6];
  for (long long i = 0; i < 3; i++) cin >> A[i];
  for (long long i = 0; i < 3; i++) cin >> B[i];
  cin >> C[2] >> C[3] >> C[4] >> C[5] >> C[0] >> C[1];
  long long ans = 0;
  for (long long i = 0; i < 3; i++) {
    bool f1, f2;
    f1 = (A[i] >= 0);
    f2 = (B[i] > 0);
    if (f1 ^ f2) {
      ans += C[2 * i];
    } else if (f1 & f2) {
      if (A[i] > B[i]) ans += C[2 * i + 1];
    } else {
      if (A[i] < B[i]) ans += C[2 * i + 1];
    }
  }
  cout << ans << "\n";
  return 0;
}
