#include <bits/stdc++.h>
using namespace std;
const double pi = acos(-1.0);
const double eps = 1e-8;
const int inf = 0x7FFFFFFF;
template <class T>
void show(T a, int n) {
  for (int i = 0; i < n; ++i) cout << a[i] << ' ';
  cout << endl;
}
template <class T>
void show(T a, int r, int l) {
  for (int i = 0; i < r; ++i) show(a[i], l);
  cout << endl;
}
int k[7];
int main() {
  int i, j, ans;
  int a, b, c, x, y, z;
  cin >> a >> b >> c >> x >> y >> z;
  for (i = 0; i < 6; i++) cin >> k[i];
  ans = 0;
  if (a > x) {
    ans += k[5];
  } else if (a < 0)
    ans += k[4];
  if (b > y)
    ans += k[1];
  else if (b < 0)
    ans += k[0];
  if (c > z)
    ans += k[3];
  else if (c < 0)
    ans += k[2];
  cout << ans;
  return 0;
}
