import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[] arr = new int[n]; TreeSet sticks = new TreeSet<>(); TreeSet nexts = new TreeSet(new Comparator() { public int compare(Stick s1, Stick s2) { if (s1.idx == s2.idx) { return 0; } else { double diff = s1.value / s1.count - s2.value / s2.count; if (diff == 0) { return s1.idx - s2.idx; } else if (diff < 0) { return -1; } else { return 1; } } } }); for (int i = 0; i < n; i++) { arr[i] = sc.nextInt(); Stick s = new Stick(i, arr[i]); sticks.add(s); nexts.add(s); } Arrays.sort(arr); int q = sc.nextInt(); Question[] questions = new Question[q]; for (int i = 0; i < q; i++) { questions[i] = new Question(i, sc.nextInt()); } Arrays.sort(questions); double[] ans = new double[q]; int count = n; for (int i = 0; i < q; i++) { if (questions[i].value <= n) { ans[questions[i].idx] = arr[n - questions[i].value]; } else { while (count < questions[i].value) { Stick s = sticks.pollLast(); nexts.remove(s); s.add(); sticks.add(s); nexts.add(s); count++; } ans[questions[i].idx] = nexts.first().getValue(); } } StringBuilder sb = new StringBuilder(); for (double x : ans) { sb.append(x).append("\n"); } System.out.print(sb); } static class Stick implements Comparable { int idx; double value; int count = 1; public Stick(int idx, double value) { this.idx = idx; this.value = value; } public int hashCode() { return idx; } public boolean equals(Object o) { Stick s = (Stick)o; return idx == s.idx; } public int compareTo(Stick another) { if (idx == another.idx) { return 0; } else { double diff = value / (count + 1) - another.value / (another.count + 1); if (diff == 0) { return idx - another.idx; } else if (diff < 0) { return -1; } else { return 1; } } } public double getValue() { return value / count; } public void add() { count++; } } static class Question implements Comparable { int idx; int value; public Question(int idx, int value) { this.idx = idx; this.value = value; } public int compareTo(Question another) { return value - another.value; } } }