Problem: Jack has become a soldier now. Unfortunately, he has trouble with the drill. Instead of marching beginning with the left foot and then changing legs with each step, as ordered, he keeps repeating a sequence of steps, in which he sometimes makes the wrong steps or — horror of horrors! — stops for a while. For example, if Jack uses the sequence 'right, left, break', when the sergeant yells: 'Left! Right! Left! Right! Left! Right!', Jack first makes a step with the right foot, then one with the left foot, then he is confused and stops for a moment, then again - this time according to the order - starts with the right foot, then uses the left foot, then - to the sergeant's irritation - he stops to catch his breath, to incorrectly start with the right foot again... Marching this way, Jack will make the step that he is supposed to in the given moment in only one third of cases.

When the officers convinced him he should do something about it, Jack decided to modify the basic sequence of steps that he repeats. However, in order not to get too tired, he has decided that the only thing he'll do is adding any number of breaks in any positions of the original sequence (a break corresponds to stopping for the duration of one step). Of course, Jack can't make a step on the same foot twice in a row, if there is no pause between these steps. It is, however, not impossible that the sequence of steps he used so far is incorrect (it would explain a lot, actually).

Help Private Jack! Given the sequence of steps he keeps repeating, calculate the maximal percentage of time that he can spend marching correctly after adding some breaks to his scheme.

Input

The first line of input contains a sequence consisting only of characters 'L', 'R' and 'X', where 'L' corresponds to a step with the left foot, 'R' — with the right foot, and 'X' — to a break. The length of the sequence will not exceed 106.

Output

Output the maximum percentage of time that Jack can spend marching correctly, rounded down to exactly six digits after the decimal point.

Examples

Input

X


Output

0.000000


Input

LXRR


Output

50.000000

Note

In the second example, if we add two breaks to receive LXXRXR, Jack will march: LXXRXRLXXRXRL... instead of LRLRLRLRLRLRL... and will make the correct step in half the cases. If we didn't add any breaks, the sequence would be incorrect — Jack can't step on his right foot twice in a row.

Solution (in JAVA):

Solution:
import java.io.PrintWriter;
import java.text.DecimalFormat;
import java.util.Locale;
import java.util.Random;
import java.util.Scanner;

public class E {

    char[] step;
    int[] skips;
    int finalSkip;
    int totalSkip;
    int steps;

    public void run(Scanner in, PrintWriter out) {
        String s = in.next();
//        StringBuilder b = new StringBuilder();
//        Random r = new Random(12);
//        for (int i = 0; i < 1000000; i++) {
//            switch (r.nextInt(3)) {
//                case 0:
//                    b.append('X');
//                    break;
//                case 1:
//                    b.append('L');
//                    break;
//                case 2:
//                    b.append('R');
//                    break;
//            }
//        }
//        s = b.toString();
//        long t = System.nanoTime();
        step = new char[s.length()];
        skips = new int[s.length()];
        steps = 0;
        int skip = 0;
        totalSkip = 0;
        for (int i = 0; i < s.length(); i++) {
            switch (s.charAt(i)) {
                case 'X':
                    skip++;
                    totalSkip++;
                    break;
                case 'L':
                case 'R':
                    step[steps] = s.charAt(i);
                    if (steps > 0 && step[steps - 1] == step[steps] && skip == 0) {
                        skip = 1;
                        totalSkip++;
                    }
                    skips[steps] = skip;
                    steps++;
                    skip = 0;
                    break;
                default:
                    throw new RuntimeException();
            }
        }
        if (steps == 0) {
            out.println("0.000000");
            return;
        }
        finalSkip = skip;
        if (finalSkip == 0 && skips[0] == 0 && step[0] == step[steps - 1]) {
            if (step[0] == 'L') finalSkip++;
            else skips[0]++;
            totalSkip++;
        }
        int oddTotal = totalSkip + steps;
        if (oddTotal % 2 == 0) {
            oddTotal++;
        }
        double left = steps / (double) (2 * oddTotal);
        left = Math.floor(left * 1e8) / 1e8;
        double right = 1;
        while (right > left + 1.5e-8) {
            double middle = (left + right) / 2;
            middle = Math.round(middle * 1e8) / 1e8;
            double finalScore = calcDyn(middle);
            if (finalScore >= -1e-10) {
                left = middle;
            } else {
                right = middle;
            }
        }
        out.println(new DecimalFormat("0.000000").format(Math.round(left * 1e8) / 1e6));
//        System.err.println((System.nanoTime() - t) / 1000000);
    }

    private double calcDyn(double middle) {
        double curEven = -1e+100;
        double curOdd = 0;
        double diff = -(totalSkip + steps) * middle;
        for (int i = 0; i < steps; i++) {
            double nextEven;
            double nextOdd;
            //double delta = -(skips[i] + 1) * middle;
            int odd = skips[i] & 1;
            if (odd == 0) {
                nextEven = Math.max(curEven - middle, curOdd);
                nextOdd = Math.max(curEven, curOdd - middle);
            } else {
                nextEven = Math.max(curEven, curOdd - middle);
                nextOdd = Math.max(curEven - middle, curOdd);
            }
            if (step[i] == 'L') {
                nextEven += 1;
            } else {
                nextOdd += 1;
            }
            curEven = nextEven;
            curOdd = nextOdd;
        }
        int odd = finalSkip & 1;
        return Math.max(curEven - (odd ^ 1) * middle, curOdd - (odd) * middle) + diff;
    }

    public static void main(String[] args) {
        try (Scanner in = new Scanner(System.in);
             PrintWriter out = new PrintWriter(System.out)
        ) {
            Locale.setDefault(Locale.US);
            new E().run(in, out);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}