#3
x = int(input())
y = (x**2 - 5*x + 17/x)**3 - 5
print(y)
#4
num = int(input())
print(num % 10)
#5
time = int(input())
print(time // 60)
#3
x = int(input())
y = (x**2 - 5*x + 17/x)**3 - 5
print(y)
#4
num = int(input())
print(num % 10)
#5
time = int(input())
print(time // 60)