n = int(input())
dp = [0] * (n + 1)


def handshake():
    i = 0
    while i < n:
        i += 1
        if i < 3:
            dp[i] = i
        else:
            dp[i] = (dp[i - 1] + dp[i - 2]) % 10


handshake()
print(dp[n])

152ba07fc19e12e90e54fb174006658f50c26cd2
<mask token>

<mask token>


def handshake():
    i = 0
    while i < n:
        i += 1
        if i < 3:
            dp[i] = i
        else:
            dp[i] = (dp[i - 1] + dp[i - 2]) % 10


<mask token>

<mask token>


def handshake():
    i = 0
    while i < n:
        i += 1
        if i < 3:
            dp[i] = i
        else:
            dp[i] = (dp[i - 1] + dp[i - 2]) % 10


handshake()
print(dp[n])

n = int(input())
dp = [0] * (n + 1)


def handshake():
    i = 0
    while i < n:
        i += 1
        if i < 3:
            dp[i] = i
        else:
            dp[i] = (dp[i - 1] + dp[i - 2]) % 10


handshake()
print(dp[n])
