Problem: Vasya and Kolya play a game with a string, using the following rules. Initially, Kolya creates a string s, consisting of small English letters, and uniformly at random chooses an integer k from a segment [0, len(s) - 1]. He tells Vasya this string s, and then shifts it k letters to the left, i. e. creates a new string t = sk + 1sk + 2... sns1s2... sk. Vasya does not know the integer k nor the string t, but he wants to guess the integer k. To do this, he asks Kolya to tell him the first letter of the new string, and then, after he sees it, open one more letter on some position, which Vasya can choose.

Vasya understands, that he can't guarantee that he will win, but he wants to know the probability of winning, if he plays optimally. He wants you to compute this probability. 

Note that Vasya wants to know the value of k uniquely, it means, that if there are at least two cyclic shifts of s that fit the information Vasya knowns, Vasya loses. Of course, at any moment of the game Vasya wants to maximize the probability of his win.

Input

The only string contains the string s of length l (3 ≤ l ≤ 5000), consisting of small English letters only.

Output

Print the only number — the answer for the problem. You answer is considered correct, if its absolute or relative error does not exceed 10 - 6.

Formally, let your answer be a, and the jury's answer be b. Your answer is considered correct if <image>

Examples

Input

technocup


Output

1.000000000000000


Input

tictictactac


Output

0.333333333333333


Input

bbaabaabbb


Output

0.100000000000000

Note

In the first example Vasya can always open the second letter after opening the first letter, and the cyclic shift is always determined uniquely.

In the second example if the first opened letter of t is "t" or "c", then Vasya can't guess the shift by opening only one other letter. On the other hand, if the first letter is "i" or "a", then he can open the fourth letter and determine the shift uniquely.

Solution (in JAVA):

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

public class Main {
    public Main() throws IOException {
    }

    static int countUnique(ArrayList<Character> list) {
        Map<Character, Integer> map = new HashMap<>();
        for (char c : list) {
            if (map.containsKey(c)) {
                int count = map.get(c);
                map.put(c, count + 1);
            } else {
                map.put(c, 1);
            }
        }

        int count = 0;
        for (Map.Entry<Character, Integer> entry : map.entrySet()) {
            if (entry.getValue() == 1) count++;
        }

        return count;
    }

    static String shiftLeft(String s, int k) {
        String s1 = s.substring(0, k);
        String s2 = s.substring(k, s.length());
        return s2 + s1;
    }

    static void solve() throws IOException {
        String s = input.readLine();
        int n = s.length();
        Map<Character, ArrayList<Integer>> map = new HashMap<>();
        for (int i = 0; i < n; i++) {
            char c = s.charAt(i);
            if (map.containsKey(c)) {
                ArrayList<Integer> list = map.get(c);
                list.add(i);
                map.put(c, list);
            } else {
                ArrayList<Integer> list = new ArrayList<>();
                list.add(i);
                map.put(c, list);
            }
        }

        int count = 0;

        for (Map.Entry<Character, ArrayList<Integer>> entry : map.entrySet()) {
            ArrayList<Integer> list = entry.getValue();
            ArrayList<Character> samePosition = new ArrayList<>();
            int k = list.size();
            String t[] = new String[k];
            for (int i = 0; i < k; i++) {
                t[i] = shiftLeft(s, list.get(i));
            }

            int max = 0;
            for (int i = 0; i < n; i++) {
                samePosition.clear();
                for (int j = 0; j < k; j++) {
                    samePosition.add(t[j].charAt(i));
                }
                max = Math.max(max, countUnique(samePosition));
            }
            count += max;
        }

        ans.append((float)count/n);
        output.write(ans.toString());
        output.flush();
        output.close();
    }

    public static void main(String[] args) throws IOException {
        new Main().solve();
    }

    static BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
    static BufferedWriter output = new BufferedWriter(new OutputStreamWriter(System.out));
    static StringBuilder ans = new StringBuilder();
    static StringTokenizer stringTokenizer;

    static int ni1() throws IOException {
        return Integer.parseInt(input.readLine());
    }

    static int ni2() throws IOException {
        return Integer.parseInt(stringTokenizer.nextToken());
    }

    static long nl1() throws IOException {
        return Long.parseLong(input.readLine());
    }

    static long nl2() {
        return Long.parseLong(stringTokenizer.nextToken());
    }

    static void rl() throws IOException {
        stringTokenizer = new StringTokenizer(input.readLine());
    }
}