def arrange(N):
    if N == 0:
        return 1
    elif N == 1:
        return 0
    elif N == 2:
        return 1
    else:
        return (N - 1) * (arrange(N - 1) + arrange(N - 2))


N = int(input())
print(arrange(N) % 1000000007)

fa0d2183c5fb3cb9c2a2dca77ebe003557a4898c
<mask token>

def arrange(N):
    if N == 0:
        return 1
    elif N == 1:
        return 0
    elif N == 2:
        return 1
    else:
        return (N - 1) * (arrange(N - 1) + arrange(N - 2))


<mask token>

def arrange(N):
    if N == 0:
        return 1
    elif N == 1:
        return 0
    elif N == 2:
        return 1
    else:
        return (N - 1) * (arrange(N - 1) + arrange(N - 2))


<mask token>
print(arrange(N) % 1000000007)

def arrange(N):
    if N == 0:
        return 1
    elif N == 1:
        return 0
    elif N == 2:
        return 1
    else:
        return (N - 1) * (arrange(N - 1) + arrange(N - 2))


N = int(input())
print(arrange(N) % 1000000007)
