from math import factorial as fac, exp

def a(n):
    if n > 1:
        s = 0
        for k in range(2,n+1):
            s+=fac(n)*(-1)**(n-k)/fac(k)
        return s
    else:
        if n == 0:
            return 1
        else:
            return 0

def b(n):
    return (-1)**(n+1)*fac(n)

def I(n):
    return a(n)*exp(1)+b(n)
