#include <bits/stdc++.h>
int main() {
  int n;
  int a[50] = {0}, b[50] = {0}, c[50] = {0};
  int point = 0, bonus = 0, sumPoint = 0;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d ", &a[i]);
    printf("%3d ", a[i]);
  }
  printf("\n");
  for (int i = 0; i < n; i++) {
    scanf("%d ", &b[i]);
    printf("%3d ", b[i]);
    point += b[i];
  }
  printf("\n");
  for (int i = 0; i < n; i++) {
    scanf("%d ", &c[i]);
    printf("%3d ", c[i]);
    bonus += c[i];
  }
  printf("\n");
  sumPoint = point + bonus - c[a[n - 1] - 1];
  printf("%d", sumPoint);
}
