#include <bits/stdc++.h>
using namespace std;
int main() {
  int x, y, z;
  int x1, y1, z1;
  cin >> x >> y >> z;
  cin >> x1 >> y1 >> z1;
  int ara[6];
  for (int i = 0; i < 6; i++) cin >> ara[i];
  int res[6] = {0};
  if (y < 0) res[0] = 1;
  if (y > y1) res[1] = 1;
  if (z < 0) res[2] = 1;
  if (z > z1) res[3] = 1;
  if (x < 0) res[4] = 1;
  if (x > x1) res[5] = 1;
  int ans = 0;
  for (int i = 0; i < 6; i++) ans += res[i] * ara[i];
  cout << ans;
}
