#include <bits/stdc++.h>
using namespace std;
int in() {
  int r = 0, c;
  for (c = getchar(); c <= 32; c = getchar())
    ;
  if (c == '-') return -in();
  for (; c > 32; r = (r << 1) + (r << 3) + c - '0', c = getchar())
    ;
  return r;
}
int main() {
  int x = in(), y = in(), z = in(), x1 = in(), y1 = in(), z1 = in(), a[6],
      res = 0;
  for (int i = (0); i < (6); i++) a[i] = in();
  if (y > y1)
    res += a[1];
  else if (y < 0)
    res += a[0];
  if (z > z1)
    res += a[3];
  else if (z < 0)
    res += a[2];
  if (x > x1)
    res += a[5];
  else if (x < 0)
    res += a[4];
  printf("%d\n", res);
  return 0;
}
