#include <bits/stdc++.h>
using namespace std;
int mc[3], cor[3], s[7], tot;
int sol(int cuad) {
  if (cuad == 1) return (s[2] + s[3] + s[5]);
  if (cuad == 2) return (s[2] + s[3]);
  if (cuad == 3) return (s[2] + s[3] + s[6]);
  if (cuad == 4) return (s[2] + s[5]);
  if (cuad == 5) return (s[2]);
  if (cuad == 6) return (s[2] + s[6]);
  if (cuad == 7) return (s[2] + s[4] + s[5]);
  if (cuad == 8) return (s[2] + s[4]);
  if (cuad == 9) return (s[2] + s[4] + s[6]);
  if (cuad == 10) return (s[3] + s[5]);
  if (cuad == 11) return (s[3]);
  if (cuad == 12) return (s[3] + s[6]);
  if (cuad == 13) return (s[5]);
  if (cuad == 14) return tot;
  if (cuad == 15) return (s[6]);
  if (cuad == 16) return (s[4] + s[5]);
  if (cuad == 17) return (s[4]);
  if (cuad == 18) return (s[4] + s[6]);
  if (cuad == 19) return (s[1] + s[3] + s[5]);
  if (cuad == 20) return (s[1] + s[3]);
  if (cuad == 21) return (s[1] + s[3] + s[6]);
  if (cuad == 22) return (s[2] + s[5]);
  if (cuad == 23) return (s[1]);
  if (cuad == 24) return (s[1] + s[6]);
  if (cuad == 25) return (s[1] + s[4] + s[5]);
  if (cuad == 26) return (s[1] + s[4]);
  if (cuad == 27) return (s[1] + s[4] + s[6]);
}
int main() {
  scanf("%d %d %d", &mc[0], &mc[1], &mc[2]);
  scanf("%d %d %d", &cor[0], &cor[1], &cor[2]);
  for (int i = 1; i <= 6; i++) {
    scanf("%d", &s[i]);
    tot += s[i];
  }
  int cuad = 0;
  if (mc[0] < 0)
    cuad = 1;
  else if (mc[0] > cor[0])
    cuad = 3;
  else
    cuad = 2;
  if (mc[2] < 0)
    cuad += 0;
  else if (mc[2] > cor[2])
    cuad += 6;
  else
    cuad += 3;
  if (mc[1] < 0)
    cuad += 18;
  else if (mc[1] > cor[1])
    cuad += 0;
  else
    cuad += 9;
  cout << sol(cuad) << "\n";
}
