Problem:
Score : 800 points

Problem Statement

There are N rabbits on a number line.
The rabbits are conveniently numbered 1 through N.
The coordinate of the initial position of rabbit i is x_i.

The rabbits will now take exercise on the number line, by performing sets described below.
A set consists of M jumps. The j-th jump of a set is performed by rabbit a_j (2≤a_j≤N-1).
For this jump, either rabbit a_j-1 or rabbit a_j+1 is chosen with equal probability (let the chosen rabbit be rabbit x), then rabbit a_j will jump to the symmetric point of its current position with respect to rabbit x.

The rabbits will perform K sets in succession.
For each rabbit, find the expected value of the coordinate of its eventual position after K sets are performed.

Constraints

3≤N≤10^5

x_i is an integer.

|x_i|≤10^9

1≤M≤10^5

2≤a_j≤N-1

1≤K≤10^{18}

Input

The input is given from Standard Input in the following format:

N
x_1 x_2 ... x_N
M K
a_1 a_2 ... a_M

Output

Print N lines.
The i-th line should contain the expected value of the coordinate of the eventual position of rabbit i after K sets are performed.
The output is considered correct if the absolute or relative error is at most 10^{-9}.

Sample Input 1

3
-1 0 2
1 1
2

Sample Output 1

-1.0
1.0
2.0

Rabbit 2 will perform the jump.
If rabbit 1 is chosen, the coordinate of the destination will be -2.
If rabbit 3 is chosen, the coordinate of the destination will be 4.
Thus, the expected value of the coordinate of the eventual position of rabbit 2 is 0.5×(-2)+0.5×4=1.0.

Sample Input 2

3
1 -1 1
2 2
2 2

Sample Output 2

1.0
-1.0
1.0

x_i may not be distinct.

Sample Input 3

5
0 1 3 6 10
3 10
2 3 4

Sample Output 3

0.0
3.0
7.0
8.0
10.0

Solution in Java8 (OpenJDK 1.8.0) (judge verdict: Accepted)

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.NoSuchElementException;

/*
                   _ooOoo_
                  o8888888o
                  88" . "88
                  (| -_- |)
                  O\  =  /O
               ____/`---'\____
             .'  \\|     |//  `.
            /  \\|||  :  |||//  \
           /  _||||| -:- |||||-  \
           |   | \\\  -  /// |   |
           | \_|  ''\---/''  |   |
           \  .-\__  `-`  ___/-. /
         ___`. .'  /--.--\  `. . __
      ."" '<  `.___\_<|>_/___.'  >'"".
     | | :  `- \`.;`\ _ /`;.`/ - ` : | |
     \  \ `-.   \_ __\ /__ _/   .-` /  /
======`-.____`-.___\_____/___.-`____.-'======
                   `=---='
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
            pass System Test!
*/

public class Main {
  private static class Task {

    int[] mul(int[] a, long K) {
      int[] cur = Arrays.copyOf(a, a.length);
      int[] x = new int[a.length];
      for (int i = 0; i < x.length; i++) x[i] = i;
      while (K > 0) {
        if ((K & 1) == 1) {
          int[] y = new int[x.length];
          for (int i = 0; i < x.length; i++) {
            y[i] = x[cur[i]];
          }
          x = y;
        }
        K >>= 1;
        int[] tmp = new int[cur.length];
        for (int i = 0; i < cur.length; i++) {
          tmp[i] = cur[cur[i]];
        }
        cur = tmp;
      }
      return x;
    }

    void solve(FastScanner in, PrintWriter out) throws Exception {

      int N = in.nextInt();
      long[] dp = new long[N];
      for (int i = 0; i < N; i++) {
        dp[i] = in.nextInt();
      }
      int M = in.nextInt();
      long K = in.nextLong();
      int[] a = new int[M];
      for (int i = 0; i < M; i++) a[i] = in.nextInt() - 1;

      int[] b = new int[N - 1];
      for (int i = 0; i < N - 1; i++) b[i] = i;
      for (int x : a) {
        int tmp = b[x];
        b[x] = b[x - 1];
        b[x - 1] = tmp;
      }
      b = mul(b, K);
      long[] diff = new long[b.length];
      for (int i = 0; i < b.length; i++) {
        int j = b[i];
        diff[i] = dp[j + 1] - dp[j];
      }
      long cur = dp[0];
      out.println(cur);
      for (int i = 0; i < N - 1; i++) {
        cur += diff[i];
        out.println(cur);
      }

    }
  }

  /**
   * ここから下はテンプレートです。
   */
  public static void main(String[] args) throws Exception {
    OutputStream outputStream = System.out;
    FastScanner in = new FastScanner();
    PrintWriter out = new PrintWriter(outputStream);
    Task solver = new Task();
    solver.solve(in, out);
    out.close();
  }
  private static class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int bufferLength = 0;

    private boolean hasNextByte() {
      if (ptr < bufferLength) {
        return true;
      } else {
        ptr = 0;
        try {
          bufferLength = in.read(buffer);
        } catch (IOException e) {
          e.printStackTrace();
        }
        if (bufferLength <= 0) {
          return false;
        }
      }
      return true;
    }

    private int readByte() {
      if (hasNextByte()) return buffer[ptr++];
      else return -1;
    }

    private static boolean isPrintableChar(int c) {
      return 33 <= c && c <= 126;
    }

    private void skipUnprintable() {
      while (hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;
    }

    boolean hasNext() {
      skipUnprintable();
      return hasNextByte();
    }

    public String next() {
      if (!hasNext()) throw new NoSuchElementException();
      StringBuilder sb = new StringBuilder();
      int b = readByte();
      while (isPrintableChar(b)) {
        sb.appendCodePoint(b);
        b = readByte();
      }
      return sb.toString();
    }

    long nextLong() {
      if (!hasNext()) throw new NoSuchElementException();
      long n = 0;
      boolean minus = false;
      int b = readByte();
      if (b == '-') {
        minus = true;
        b = readByte();
      }
      if (b < '0' || '9' < b) {
        throw new NumberFormatException();
      }
      while (true) {
        if ('0' <= b && b <= '9') {
          n *= 10;
          n += b - '0';
        } else if (b == -1 || !isPrintableChar(b)) {
          return minus ? -n : n;
        } else {
          throw new NumberFormatException();
        }
        b = readByte();
      }
    }

    double nextDouble() {
      return Double.parseDouble(next());
    }

    double[] nextDoubleArray(int n) {
      double[] array = new double[n];
      for (int i = 0; i < n; i++) {
        array[i] = nextDouble();
      }
      return array;
    }

    double[][] nextDoubleMap(int n, int m) {
      double[][] map = new double[n][];
      for (int i = 0; i < n; i++) {
        map[i] = nextDoubleArray(m);
      }
      return map;
    }

    public int nextInt() {
      return (int) nextLong();
    }

    public int[] nextIntArray(int n) {
      int[] array = new int[n];
      for (int i = 0; i < n; i++) array[i] = nextInt();
      return array;
    }

    public long[] nextLongArray(int n) {
      long[] array = new long[n];
      for (int i = 0; i < n; i++) array[i] = nextLong();
      return array;
    }

    public String[] nextStringArray(int n) {
      String[] array = new String[n];
      for (int i = 0; i < n; i++) array[i] = next();
      return array;
    }

    public char[][] nextCharMap(int n) {
      char[][] array = new char[n][];
      for (int i = 0; i < n; i++) array[i] = next().toCharArray();
      return array;
    }

    public int[][] nextIntMap(int n, int m) {
      int[][] map = new int[n][];
      for (int i = 0; i < n; i++) {
        map[i] = nextIntArray(m);
      }
      return map;
    }
  }
}