from random import random p = float(input()) for i in range(1000): while random() < p: c += 1 print(c / 1000)