#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
const double PI = acos(-1.0);
const double EPS = 1e-10;
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;
}
struct P3 {
  double x, y, z;
  P3() {}
  P3(double a, double b, double c) : x(a), y(b), z(c) {}
  P3(double a, double b) : x(a), y(b), z(1) {}
  bool operator==(const P3 &o) const {
    return (x == o.x && y == o.y && z == o.z);
  }
  bool operator!=(const P3 &o) const { return !(*this == o); }
  bool operator<(const P3 &o) const {
    return x < o.x || (x == o.x && y < o.y) ||
           (x == o.x && y == o.y && z < o.z);
  }
  P3 operator+(const P3 &o) {
    P3 res;
    res.x = x + o.x;
    res.y = y + o.y;
    res.z = 1;
    return res;
  }
  P3 operator-() {
    P3 res;
    res.x = -x;
    res.y = -y;
    res.z = -z;
    return res;
  }
  P3 operator-(const P3 &o) {
    P3 res;
    res.x = x - o.x;
    res.y = y - o.y;
    res.z = z - o.z;
    return res;
  }
  double operator*(const P3 &o) const {
    double res;
    res = x * o.x + y * o.y;
    return res;
  }
  P3 operator*(const double &o) const {
    P3 res;
    res.x = x * o;
    res.y = y * o;
    return res;
  }
  P3 operator/(const double &o) const {
    P3 res;
    res.x = x / o;
    res.y = y / o;
    res.z = z / o;
    return res;
  }
  P3 operator^(const P3 &o) const {
    P3 res;
    res.x = y * o.z - z * o.y;
    res.y = z * o.x - x * o.z;
    res.z = x * o.y - y * o.x;
    return res;
  }
  P3 operator~() const {
    P3 res;
    res.x = y;
    res.y = -x;
    res.z = z;
    return res;
  }
  P3 operator!() const {
    if (z == 0) return *this;
    P3 res;
    res.x = x / z;
    res.y = y / z;
    res.z = 1;
    return res;
  }
  void show() const { cerr << "V = " << x << " " << y << " " << z << endl; }
  double norm2() const { return ((*this) * (*this)); }
  double norm() const { return sqrt((*this) * (*this)); }
};
double X, Y, Z, A, B, C;
P3 M, S[7];
int F[76];
void solve() {
  A = in();
  B = in();
  C = in();
  X = in();
  Y = in();
  Z = in();
  int i;
  for (i = 0; i < 6; i++) F[i] = in();
  int ans = 0;
  M = P3(A, B, C);
  if (B > Y) ans += F[1];
  if (B < 0) ans += F[0];
  if (C > Z) ans += F[3];
  if (C < 0) ans += F[2];
  if (A > X) ans += F[5];
  if (A < 0) ans += F[4];
  cout << ans << endl;
}
int main() {
  solve();
  return 0;
}
