#include <bits/stdc++.h>
using namespace std;
int x1[3], x[3], a[7], ans = 0;
int ord[3] = {4, 0, 2};
void swap(int& a, int& b) {
  a ^= b;
  b ^= a;
  a ^= b;
}
int main() {
  for (int i = 0; i < 3; i++) cin >> x[i];
  for (int i = 0; i < 3; i++) cin >> x1[i];
  for (int i = 0; i < 6; i++) cin >> a[i];
  for (int i = 0; i < 3; i++)
    if (x1[i] < 0) x1[i] = -x1[i], x[i] = -x[i], swap(a[ord[i]], a[ord[i] + 1]);
  for (int i = 0; i < 3; i++)
    if (x[i] < 0)
      ans += a[ord[i]];
    else if (x[i] > x1[i])
      ans += a[ord[i] + 1];
  cout << ans << endl;
}
