from fractions import Fraction

def factorielle(n):
    if n == 0:
        return 1
    return n * factorielle(n-1)

def a(n):
    a = Fraction(0,1)
    for k in range(1,n-1):
        a += Fraction((-1)**k , 2**(k+1) * factorielle(n-k) )
    a = Fraction(1,2) + factorielle(n) * a + Fraction(factorielle(n) * (-1)**(n+1) , 2**(n+1))
    return a

def b(n):
    return Fraction( (-1)**(n+1) * factorielle(n) , 2**(n+1) )

n = int(input("Entrez un entier n supérieur ou égal à 1 : "))
print("I({}) = {}exp(2)/{} + {}/{}".format(n, a(n).numerator, a(n).denominator, b(n).numerator, b(n).denominator))
