import sys from collections import deque, Counter import time input = lambda: sys.stdin.readline().rstrip() ii = lambda: int(input()) mi = lambda: map(int, input().split()) li = lambda: list(mi()) inf = 2 ** 63 - 1 mod = 998244353 import random n = ii() s = input() s += '##' def roll(): now = 0 save = 0 cnt = 0 while True: c = random.choice([0, 1, 2]) cnt += 1 if c == 0: now += 1 if s[now] == '#': now = save if c == 1: now += 2 if s[now] == '#': now = save if c == 2: save = now if now == n - 1: return cnt t = time.time() cnt = 0 c = 0 while time.time() - t < 1.8: c += roll() cnt += 1 print(c / cnt)