#include <bits/stdc++.h>
using namespace std;
int vx, vy, vz, bx, by, bz;
int box[6];
int ans;
int main() {
  if (fopen("codeforces231D.in", "r")) freopen("codeforces231D.in", "r", stdin);
  scanf("%d %d %d %d %d %d", &vx, &vy, &vz, &bx, &by, &bz);
  for (int i = 0; i < 6; i++) scanf("%d", &box[i]);
  if (vy < 0)
    ans += box[0];
  else if (vy > by)
    ans += box[1];
  if (vz < 0)
    ans += box[2];
  else if (vz > bz)
    ans += box[3];
  if (vx < 0)
    ans += box[4];
  else if (vx > bx)
    ans += box[5];
  printf("%d\n", ans);
  return 0;
}
