Problem: Barney lives in country USC (United States of Charzeh). USC has n cities numbered from 1 through n and n - 1 roads between them. Cities and roads of USC form a rooted tree (Barney's not sure why it is rooted). Root of the tree is the city number 1. Thus if one will start his journey from city 1, he can visit any city he wants by following roads.

<image>

Some girl has stolen Barney's heart, and Barney wants to find her. He starts looking for in the root of the tree and (since he is Barney Stinson not a random guy), he uses a random DFS to search in the cities. A pseudo code of this algorithm is as follows:
    
    
      
    let starting_time be an array of length n  
    current_time = 0  
    dfs(v):  
    	current_time = current_time + 1  
    	starting_time[v] = current_time  
    	shuffle children[v] randomly (each permutation with equal possibility)  
    	// children[v] is vector of children cities of city v  
    	for u in children[v]:  
    		dfs(u)  
    

As told before, Barney will start his journey in the root of the tree (equivalent to call dfs(1)).

Now Barney needs to pack a backpack and so he wants to know more about his upcoming journey: for every city i, Barney wants to know the expected value of starting_time[i]. He's a friend of Jon Snow and knows nothing, that's why he asked for your help.

Input

The first line of input contains a single integer n (1 ≤ n ≤ 105) — the number of cities in USC.

The second line contains n - 1 integers p2, p3, ..., pn (1 ≤ pi < i), where pi is the number of the parent city of city number i in the tree, meaning there is a road between cities numbered pi and i in USC.

Output

In the first and only line of output print n numbers, where i-th number is the expected value of starting_time[i].

Your answer for each city will be considered correct if its absolute or relative error does not exceed 10 - 6.

Examples

Input

7
1 2 1 1 4 4


Output

1.0 4.0 5.0 3.5 4.5 5.0 5.0 


Input

12
1 1 2 2 4 4 3 3 1 10 8


Output

1.0 5.0 5.5 6.5 7.5 8.0 8.0 7.0 7.5 6.5 7.5 8.0 

Solution (in JAVA):

Solution:
import java.awt.*;
import java.io.*;
import java.util.*;

public class Main implements Runnable {

    BufferedReader in;
    PrintWriter out;
    StringTokenizer tok = new StringTokenizer("");

    void init() throws FileNotFoundException {
        try {
            in = new BufferedReader(new FileReader("input.txt"));
            out = new PrintWriter("output.txt");
        } catch (Throwable e) {
            in = new BufferedReader(new InputStreamReader(System.in));
            out = new PrintWriter(System.out);
        }
    }

    String readString() throws IOException {
        while (!tok.hasMoreTokens()) {
            try {
                tok = new StringTokenizer(in.readLine());
            } catch (Exception e) {
                return null;
            }
        }
        return tok.nextToken();
    }

    int readInt() throws IOException {
        return Integer.parseInt(readString());
    }

    int[] readIntArray(int size) throws IOException {
        int[] res = new int[size];
        for (int i = 0; i < size; i++) {
            res[i] = readInt();
        }
        return res;
    }

    long readLong() throws IOException {
        return Long.parseLong(readString());
    }

    double readDouble() throws IOException {
        return Double.parseDouble(readString());
    }

    public static void main(String[] args) {
        new Thread(null, new Main(), "", 1l * 200 * 1024 * 1024).start();
    }

    long timeBegin, timeEnd;

    void time() {
        timeEnd = System.currentTimeMillis();
        System.err.println("Time = " + (timeEnd - timeBegin));
    }

    long memoryTotal, memoryFree;

    void memory() {
        memoryFree = Runtime.getRuntime().freeMemory();
        System.err.println("Memory = " + ((memoryTotal - memoryFree) >> 10)
                + " KB");
    }

    public void run() {
        try {
            timeBegin = System.currentTimeMillis();
            memoryTotal = Runtime.getRuntime().freeMemory();
            init();
            solve();
            out.close();
            if (System.getProperty("ONLINE_JUDGE") == null) {
                time();
                memory();
            }
        } catch (Exception e) {
            e.printStackTrace();
            System.exit(-1);
        }
    }
    void solve() throws IOException {
        int n = readInt();
        int[] parent = new int[n];
        parent[0]=-1;
        for (int i = 1; i < n ; i++) {
            parent[i]=readInt()-1;
        }
        sizeOfSubtree = new int[n];
        Arrays.fill(sizeOfSubtree,0);
        depth = new int[n];
        Arrays.fill(depth,0);
        connections = new ArrayList[n];
        for (int i = 0; i < n; i++) {
            connections[i] = new ArrayList<>();
        }
        for (int i = 0; i < n; i++) {
            if (parent[i]==-1) continue;
            connections[parent[i]].add(i);
        }
        biggestDepth=0;
        calculateSubtreeSize(0, 0);
        HashMap<Integer,ArrayList<Integer>> depthToSiblings = new HashMap<>();
        for (int i = 0; i < n; i++) {
            int currentDepth = depth[i];
            if (!depthToSiblings.containsKey(currentDepth)){
                depthToSiblings.put(currentDepth, new ArrayList<>());
            }
            depthToSiblings.get(currentDepth).add(i);
        }
        double[] time = new double[n];
        time[0]=1.0;
        int[] sumOfChildrenSubtreesByFather = new int[n];
        for (int father = 0; father < n; father++) {
            ArrayList<Integer> realSiblings = connections[father];
            int sumOfSubtrees = 0;
            for (int sibling:realSiblings){
                if (sibling==-1) continue;
                sumOfSubtrees+=sizeOfSubtree[sibling];
            }
            sumOfChildrenSubtreesByFather[father]=sumOfSubtrees;
        }
        for (int i = 2; i <=biggestDepth ; i++) {
            ArrayList<Integer> relatives = depthToSiblings.get(i);
            for (int relative:relatives){
                int father = parent[relative];
                ArrayList<Integer> realSiblings = connections[father];
                double azaza = time[father]+1;
                int sumOfSubtrees = sumOfChildrenSubtreesByFather[father]-sizeOfSubtree[relative];
                azaza+=sumOfSubtrees/2D;
                time[relative]=azaza;
            }
        }
        for (int i = 0; i < n; i++) {
            out.print(time[i]+" ");
        }
    }
    int biggestDepth;
    ArrayList<Integer>[] connections;
    int[] depth;
    int[] sizeOfSubtree;
    int calculateSubtreeSize(int currentNode, int previousNode){
        int size = 1;
        depth[currentNode]=depth[previousNode]+1;
        biggestDepth=Math.max(biggestDepth,depth[currentNode]);
        for (int connection:connections[currentNode]){
            if (connection==-1) continue;
            size+=calculateSubtreeSize(connection,currentNode);
        }
        sizeOfSubtree[currentNode]=size;
        return size;
    }
}