#include <bits/stdc++.h>
using namespace std;
char buff[1000001];
int calc(string s) {
  int p = 0, q = 0, ones = 0;
  bool flippedsingle = false;
  for (int i = (0); i < (((int)(s).size())); ++i) {
    char want = (q % 2 == 0) ? 'L' : 'R';
    if (s[i] == 'X')
      ++q;
    else if (s[i] == want)
      ++p, ++q, flippedsingle = false;
    else {
      ++q;
      ++p, ++q;
      if (flippedsingle) ++ones;
      flippedsingle = !flippedsingle;
    }
  }
  if (q % 2 == 1) {
    ++q;
    if (flippedsingle) ++ones;
  }
  if (2 * p > q) p -= ones, q -= 2 * ones;
  return (long long)p * 100 * 1000000 / q;
}
void run() {
  scanf("%s", buff);
  string s;
  for (int i = 0; buff[i] != '\0'; ++i) {
    if (i > 0 && buff[i - 1] == buff[i] && buff[i] != 'X') s += 'X';
    s += buff[i];
  }
  int res;
  if (s[0] == s[((int)(s).size()) - 1] && s[0] != 'X') {
    res = max(calc(s + 'X'), calc('X' + s));
  } else {
    res = calc(s);
  }
  printf("%d.%06d\n", res / 1000000, res % 1000000);
}
int main() {
  run();
  return 0;
}
