#include <bits/stdc++.h>
using namespace std;
using sint = int64_t;
template <class T>
T read() {
  T t;
  cin >> t;
  return t;
}
template <>
string read<string>() {
  string s;
  getline(cin, s);
  return s;
}
inline void write() {}
template <class T>
void write(T const& t) {
  cout << t;
}
template <class T, class... Args>
void write(T const& t, Args const&... args) {
  cout << t << ' ';
  write(args...);
}
template <class... Args>
void writeln(Args const&... args) {
  write(args...);
  cout << '\n';
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.exceptions(ios_base::badbit | ios_base::failbit);
  cout.exceptions(ios_base::badbit | ios_base::failbit);
  cin.tie(nullptr);
  cout.tie(nullptr);
  cout.precision(16);
  void run();
  run();
  return 0;
}
void run() {
  auto const N = read<sint>();
  vector<sint> As;
  for (sint i = 0; i < N; ++i) {
    As.push_back(read<sint>());
  }
  sint sum = 0;
  for (sint i = 0; i < N; ++i) {
    sum += read<sint>();
  }
  vector<sint> Cs;
  for (sint i = 1; i < N; ++i) {
    Cs.push_back(read<sint>());
  }
  for (sint i = 1; i < N; ++i) {
    writeln(As[i - 1], As[i]);
    if (As[i - 1] + 1 == As[i]) {
      sum += Cs[As[i - 1] - 1];
    }
  }
  writeln(sum);
}
