#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-6;
void __print(int x) { cerr << x; }
void __print(long x) { cerr << x; }
void __print(long long x) { cerr << x; }
void __print(unsigned x) { cerr << x; }
void __print(unsigned long x) { cerr << x; }
void __print(unsigned long long x) { cerr << x; }
void __print(float x) { cerr << x; }
void __print(double x) { cerr << x; }
void __print(long double x) { cerr << x; }
void __print(char x) { cerr << '\'' << x << '\''; }
void __print(const char *x) { cerr << '\"' << x << '\"'; }
void __print(const string &x) { cerr << '\"' << x << '\"'; }
void __print(bool x) { cerr << (x ? "true" : "false"); }
template <typename T, typename V>
void __print(const pair<T, V> &x) {
  cerr << '{';
  __print(x.first);
  cerr << ',';
  __print(x.second);
  cerr << '}';
}
template <typename T>
void __print(const T &x) {
  int f = 0;
  cerr << '{';
  for (auto &i : x) cerr << (f++ ? "," : ""), __print(i);
  cerr << "}";
}
void _print() { cerr << "]\n"; }
template <typename T, typename... V>
void _print(T t, V... v) {
  __print(t);
  if (sizeof...(v)) cerr << ", ";
  _print(v...);
}
long long a[6];
void solve() {
  long long x, y, z;
  cin >> x >> y >> z;
  long long bx, by, bz;
  cin >> bx >> by >> bz;
  for (long long i = 0; i < 6; ++i) cin >> a[i];
  if (y >= 0) a[0] = 0;
  if (y <= by) a[1] = 0;
  if (z >= 0) a[2] = 0;
  if (z <= bz) a[3] = 0;
  if (x >= 0) a[4] = 0;
  if (x <= bx) a[5] = 0;
  long long ans = 0;
  for (long long i = 0; i < 6; ++i) ans += a[i];
  cout << ans << '\n';
}
signed main() {
  long long t = 1;
  while (t--) solve();
}
