#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int N = 1e6 + 10;
const int mod = 1e8;
const int inf = 1e9;
ll n, x, y, z, a[N], xx, yy, zz;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> xx >> yy >> zz;
  cin >> x >> y >> z;
  for (int i = 1; i <= 6; i++) cin >> a[i];
  ll ans = 0;
  if (xx > x) ans += a[6];
  if (xx < 0) ans += a[5];
  if (yy > y) ans += a[2];
  if (yy < 0) ans += a[1];
  if (zz > z) ans += a[4];
  if (zz < 0) ans += a[3];
  cout << ans << "\n";
  return 0;
}
