#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops", "omit-frame-pointer", "inline")
#pragma GCC option("arch=native", "tune=native", "no-zero-upper")
#pragma GCC target( \
    "sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
#pragma GCC optimize("Ofast")
using namespace std;
const long double pi = acos(-1);
const long long int M = 1e9 + 7, N = 1e7 + 5, INF = 1e18;
void solve() {
  long long int x, y, z, a, b, c, f1, f2, f3, f4, f5, f6, s = 0;
  cin >> x >> y >> z >> a >> b >> c >> f1 >> f2 >> f3 >> f4 >> f5 >> f6;
  if (y < 0) s += f1;
  if (y > b) s += f2;
  if (z > c) s += f4;
  if (z < 0) s += f3;
  if (x > a) s += f6;
  if (x < 0) s += f5;
  cout << s << "\n";
}
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  solve();
  return 0;
}
