#include <bits/stdc++.h>
using namespace std;
int main() {
  int x1, y1, z1;
  cin >> x1 >> y1 >> z1;
  int x, y, z;
  cin >> x >> y >> z;
  int arr[7];
  for (int i = 1; i <= 6; i++) {
    cin >> arr[i];
  }
  int total = 0;
  if (z > 0) {
    if (z1 > 0 && z1 > z)
      total += arr[4];
    else if (z1 < 0)
      total += arr[3];
  } else {
    if (z1 > 0)
      total += arr[3];
    else if (z1 < 0 && z1 < z)
      total += arr[4];
  }
  if (y > 0) {
    if (y1 > 0 && y1 > y)
      total += arr[2];
    else if (y1 < 0)
      total += arr[1];
  } else {
    if (y1 > 0)
      total += arr[1];
    else if (y1 < 0 && y1 < y)
      total += arr[2];
  }
  if (x > 0) {
    if (x1 > 0 && x1 > x)
      total += arr[6];
    else if (x1 < 0)
      total += arr[5];
  } else {
    if (x1 > 0)
      total += arr[5];
    else if (x1 < 0 && x1 < x)
      total += arr[6];
  }
  cout << total;
}
