#include <bits/stdc++.h>
#pragma comment(linker, "/stack:16777216")
namespace Template {
using namespace std;
struct debugger {
  template <typename T>
  debugger &operator,(const T &v) {
    cerr << v << " ";
    return *this;
  }
} dbg;
template <typename T>
void sci(T &t) {
  cin >> t;
}
template <typename T, typename... Ts>
void sci(T &t, Ts &...ts) {
  cin >> t;
  sci(ts...);
}
template <typename T>
inline T gcd(T a, T b) {
  T c;
  while (b) {
    c = b;
    b = a % b;
    a = c;
  }
  return a;
}
template <typename T, typename S>
ostream &operator<<(ostream &os, const pair<T, S> &v) {
  os << "(";
  os << v.first << "," << v.second << ")";
  return os;
}
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v) {
  os << "[";
  int sz = v.size();
  for (int i = 0; i < sz; ++i) {
    os << v[i];
    if (i != sz - 1) os << ",";
  }
  os << "]\n";
  return os;
}
template <typename T>
ostream &operator<<(ostream &os, const set<T> &v) {
  T last = *v.rbegin();
  os << "[";
  for (auto it : v) {
    os << it;
    if (it != last) os << ",";
  }
  os << "]\n";
  return os;
}
template <typename T, typename S>
ostream &operator<<(ostream &os, const map<T, S> &v) {
  for (auto it : v) {
    os << it.first << " : " << it.second << " , ";
  }
  return os;
}
struct _runCode {
  clock_t time;
  int m;
  _runCode(int mode) {
    m = mode;
    if (mode == -1)
      freopen(
          "C:\\Users\\Praveen\\documents\\Visual Studio "
          "2017\\Projects\\comp\\in.txt",
          "w", stdout);
    if (mode >= 1)
      freopen(
          "C:\\Users\\Praveen\\documents\\Visual Studio "
          "2017\\Projects\\comp\\in.txt",
          "r", stdin);
    if (mode == 2)
      freopen(
          "C:\\Users\\Praveen\\documents\\Visual Studio "
          "2017\\Projects\\comp\\out.txt",
          "w", stdout);
    time = clock();
  }
  ~_runCode() {
    cerr << "\nTime: " << ((float)(clock() - time) / CLOCKS_PER_SEC) << '\n';
    if (m == -1 || m == 1) fcloseall();
  }
};
};  // namespace Template
using namespace Template;
void solve() {
  int x, y, z;
  sci(x, y, z);
  ;
  int p, q, r;
  sci(p, q, r);
  ;
  vector<int> a(7, 0);
  for (int i = 0; i < (int)6; ++i) cin >> a[i + 1];
  int ans = 0;
  if (x < 0) ans += a[5];
  if (x > p) ans += a[6];
  if (y < 0) ans += a[1];
  if (y > q) ans += a[2];
  if (z < 0) ans += a[3];
  if (z > r) ans += a[4];
  cout << ans << '\n';
}
int main() {
  ;
  solve();
  return 0;
}
