import random import threading from time import sleep def solve(): N = int(input()) K = int(input()) stop_event = threading.Event() def monte(): w = g = 0 while not stop_event.is_set(): x = y = 0 for j in range(N): if j < K: x += random.randint(4, 6) else: x += random.randint(1, 6) y += random.randint(1, 6) g += 1 if x > y: w += 1 print(w / g) threading.Thread(target=monte).start() sleep(4.8) stop_event.set() if __name__ == '__main__': solve()