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 CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
long long mInv[41];
long long fact[41];
long long factInv[41];
map<string, long> cityId;
vector<pair<long, long> > criticalEdges;
vector<long> chlds[100005];
long long heights[5];
long long segTree[3];
long nums[5005];
long g[5005];
long grid[15][15];
double verMax = 0, horMax = 0, leftMax = 0, rightMax = 0;
long base = 1005;
vector<long> primes;
vector<long> badPrimes;
long funcVal[1];
long dfs_num[29], dfs_low[29], visited[29], parent[100009], criticalNode[19];
long long N;
set<string> dictionary;
pair<set<string>::iterator, bool> ret;
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  if (a % b == 0) return b;
  return gcd(b, a % b);
}
long long getmoduloInv(long long n) {
  if (n == 1) return 1;
  if (mInv[n] > 0) return mInv[n];
  long long m = (-1 * 1000000007) / n;
  m += 1000000007;
  m *= getmoduloInv(1000000007 % n);
  mInv[n] = (m % 1000000007);
  return mInv[n];
}
vector<long> get_primes(unsigned long maxN) {
  char *sieve;
  sieve = new char[maxN / 8 + 1];
  long m = (maxN / 8) + 1;
  for (long long i = 0; i < m; i++) sieve[i] = 255;
  for (unsigned long x = 2; x <= maxN; x++)
    if (sieve[x / 8] & (0x01 << (x % 8))) {
      primes.push_back(x);
      for (unsigned long j = 2 * x; j <= maxN; j += x)
        sieve[j / 8] &= ~(0x01 << (j % 8));
    }
  delete[] sieve;
  return primes;
}
long long getPow(long long b, long long p) {
  if (b < 2 || p == 1) return b;
  if (p == 0) return 1;
  long long val = getPow(b, p / 2);
  val *= val;
  val %= 1000000007;
  if (p % 2 == 1) {
    val *= b;
    val %= 1000000007;
  }
  return val;
}
void buildSegTree(long node, long b, long e) {
  if (b == e)
    segTree[node] = b;
  else {
    long mid = (b + e) / 2;
    buildSegTree(node * 2, b, mid);
    buildSegTree(1 + node * 2, mid + 1, e);
    if (heights[segTree[node * 2]] <= heights[segTree[1 + node * 2]])
      segTree[node] = segTree[node * 2];
    else
      segTree[node] = segTree[1 + node * 2];
  }
}
long long getMin(long node, long segBeg, long segEnd, long qBeg, long qEnd) {
  if (segEnd < qBeg || segBeg > qEnd) return N + 1;
  if (segBeg >= qBeg && segEnd <= qEnd) return segTree[node];
  long mid = (segBeg + segEnd) / 2;
  long fh = getMin(node * 2, segBeg, mid, qBeg, qEnd);
  long sh = getMin(1 + node * 2, mid + 1, segEnd, qBeg, qEnd);
  if (heights[sh] < heights[fh]) return sh;
  return fh;
}
long bff[1100];
long inq[1010];
long source;
long oneEndBig = 0, oneEndSmall = 0, twoendans, zeroendans;
vector<pair<long, pair<long, long> > > allopenANs;
long bigEntry, bigExit, smallEntry, smallExit;
long dfs(long node, long curLen) {
  if (inq[node] == 0) {
    inq[node] = 1;
    dfs(bff[node], curLen + 1);
  } else if (node == source) {
    if (zeroendans < curLen) zeroendans = curLen;
  } else if (bff[bff[node]] == node) {
    curLen -= 2;
    pair<long, pair<long, long> > oA;
    oA.first = curLen;
    oA.second.first = bff[node];
    oA.second.first = node;
    allopenANs.push_back(oA);
  }
  return 0;
}
long dp[10][5];
long long betPlaced[40];
long long cumBet[40];
double numberOfchilds[100005];
double expectedTime[100005];
void countChilds(long node) {
  numberOfchilds[node] = 1;
  for (long i = 0; i < chlds[node].size(); i++) {
    countChilds(chlds[node][i]);
    numberOfchilds[node] += numberOfchilds[chlds[node][i]];
  }
}
double calculateExpectedTime(long node) {
  if (node == 1)
    expectedTime[node] = 1.0;
  else
    expectedTime[node] =
        1.0 + expectedTime[parent[node]] +
        (numberOfchilds[parent[node]] - (numberOfchilds[node] + 1)) / 2.0;
  return expectedTime[node];
}
int main(void) {
  long long test_cases = 1, l, seed = 1, ans = 1, B, P;
  long long totalPlayer;
  long long an;
  string s, intPart, decPart;
  cout << setprecision(15) << fixed;
  long long divv = 1;
  long long a, b, w, q, typ, u, v;
  for (long T = 0; T < test_cases; T++) {
    cin >> N;
    for (long i = 2; i <= N; i++) {
      cin >> parent[i];
      chlds[parent[i]].push_back(i);
    }
    countChilds(1);
    for (long i = 1; i <= N; i++) cout << calculateExpectedTime(i) << " ";
  }
  return 0;
}