#include <bits/stdc++.h>
using namespace std;
void fast() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
}
long long dotproduct(vector<long long>& a, vector<long long>& b) {
  long long sum = 0;
  for (long long i = 0; i < a.size(); i += 1) {
    sum += a[i] * b[i];
  }
  return sum;
}
int main() {
  fast();
  long long px, py, pz;
  long long x, y, z;
  cin >> px >> py >> pz >> x >> y >> z;
  px *= 2;
  py *= 2;
  pz *= 2;
  x *= 2;
  y *= 2;
  z *= 2;
  long long a1, a2, a3, a4, a5, a6;
  cin >> a1 >> a2 >> a3 >> a4 >> a5 >> a6;
  long long res = 0;
  vector<long long> zoxnv = {0, -1, 0};
  vector<long long> zox2nv = {0, 1, 0};
  vector<long long> xoynv = {0, 0, -1};
  vector<long long> xoy2nv = {0, 0, 1};
  vector<long long> yoznv = {-1, 0, 0};
  vector<long long> yoz2nv = {1, 0, 0};
  vector<long long> seezox = {px - (x / 2), py, pz - (z / 2)};
  if (dotproduct(seezox, zoxnv) > 0) {
    res += a1;
  }
  vector<long long> seezox2 = {px - (x / 2), py - y, pz - (z / 2)};
  if (dotproduct(seezox2, zox2nv) > 0) {
    res += a2;
  }
  vector<long long> seexoy = {px - (x / 2), py - (y / 2), pz};
  if (dotproduct(seexoy, xoynv) > 0) {
    res += a3;
  }
  vector<long long> seexoy2 = {px - (x / 2), py - (y / 2), pz - z};
  if (dotproduct(seexoy2, xoy2nv) > 0) {
    res += a4;
  }
  vector<long long> seeyoz = {px, py - (y / 2), pz - (z / 2)};
  if (dotproduct(seeyoz, yoznv) > 0) {
    res += a5;
  }
  vector<long long> seeyoz2 = {px - x, py - (y / 2), pz - (z / 2)};
  if (dotproduct(seeyoz2, yoz2nv) > 0) {
    res += a6;
  }
  cout << res;
}
