#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
const long long N = 2e5 + 6;
const long long inf = 1e15;
long long ex, ey, ez, bx, by, bz, a[7];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  if (fopen("inp.txt", "r")) {
    freopen("inp.txt", "r", stdin);
    freopen("outp.txt", "w", stdout);
  }
  cin >> ex >> ey >> ez;
  cin >> bx >> by >> bz;
  long long i, ans = 0;
  for (i = 1; i <= 7; i++) cin >> a[i];
  if (ex > bx)
    ans += a[6];
  else if (ex < 0)
    ans += a[5];
  if (ey > by)
    ans += a[2];
  else if (ey < 0)
    ans += a[1];
  if (ez > bz)
    ans += a[4];
  else if (ez < 0)
    ans += a[3];
  cout << ans;
  return 0;
}
