import java.io.*;
import java.util.Arrays;
import java.util.Random;
import java.util.StringTokenizer;

public class wheel_ak_kruskal {

    static class Edge implements Comparable<Edge> {
        int v1, v2;
        long w;

        Edge(int v1, int v2, long w) {
            this.v1 = v1;
            this.v2 = v2;
            this.w = w;
        }

        @Override
        public int compareTo(Edge e) {
            return Long.signum(w - e.w);
        }

        @Override
        public String toString() {
            return "Edge{" +
                    "v1=" + v1 +
                    ", v2=" + v2 +
                    ", w=" + w +
                    '}';
        }
    }

    static class DSU {
        int n;
        int[] p;
        static final Random rnd = new Random(3);

        DSU(int n) {
            this.n = n;
            p = new int[n];
            for (int i = 0; i < n; i++) {
                p[i] = i;
            }
        }

        int get(int v) {
            return (v == p[v]) ? v : (p[v] = get(p[v]));
        }

        void unite(int v1, int v2) {
            v1 = get(v1);
            v2 = get(v2);
            if (rnd.nextBoolean()) {
                p[v1] = v2;
            } else {
                p[v2] = v1;
            }
        }
    }

    long wMST(Edge[] edges, int n) {
        Arrays.sort(edges);
        DSU dsu = new DSU(n);
        long wMST = 0;
        for (Edge e : edges) {
            if (dsu.get(e.v1) != dsu.get(e.v2)) {
                dsu.unite(e.v1, e.v2);
                wMST += e.w;
            }
        }
        return wMST;
    }

    void solve() throws IOException {
        int n = in.nextInt();
        Edge[] edges = new Edge[2 * n];
        Edge[] copyOfEdges = new Edge[2 * n];
        for (int i = 0; i < n; i++) {
            copyOfEdges[i] = edges[i] = new Edge(0, i + 1, in.nextInt());
        }
        for (int i = 0; i < n; i++) {
            copyOfEdges[i + n] = edges[i + n] = new Edge(i + 1, (i + 1) % n + 1, in.nextInt());
        }
        out.println(wMST(copyOfEdges, n + 1));
        int m = in.nextInt();
        for (int i = 0; i < m; i++) {
            int a = in.nextInt();
            int b = in.nextInt();
            if (a > b) {
                int tmp = a;
                a = b;
                b = tmp;
            }
            int e = -1;
            if (a == 0)
                e = b - 1;
            else if (a != 1) {
                e = a + n - 1;
            } else if (b == 2) {
                e = n;
            } else {
                e = 2 * n - 1;
            }
            edges[e].w = in.nextInt();

            out.println(wMST(copyOfEdges, n + 1));
        }
    }

    static MyScanner in;
    static PrintWriter out;

    public static void main(String[] args) throws IOException {
        in = new MyScanner(new FileReader("wheel.in"));
        out = new PrintWriter("wheel.out");
        new wheel_ak_kruskal().solve();
        out.close();
    }

    static class MyScanner {
        BufferedReader br;
        StringTokenizer st;

        MyScanner(Reader r) {
            br = new BufferedReader(r);
        }

        String nextToken() throws IOException {
            while (st == null || !st.hasMoreTokens())
                st = new StringTokenizer(br.readLine());
            return st.nextToken();
        }

        int nextInt() throws IOException {
            return Integer.parseInt(nextToken());
        }
    }

}
