def main():
n,k=list(map(int,input().split()))
S=0
fact=[1,1,2,6,24]
for i in range(0,min(n,4)+1):
S+=fact[i]**k
print(S%10) if S%10 else print((S/10)%10)
main()
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
27 ms |
3 KB |
answer is '4' |
2 |
Correct |
27 ms |
3 KB |
answer is '2' |
3 |
Correct |
30 ms |
3 KB |
answer is '2' |
4 |
Correct |
29 ms |
3 KB |
answer is '2' |
5 |
Correct |
29 ms |
3 KB |
answer is '2' |
6 |
Correct |
27 ms |
3 KB |
answer is '4' |
7 |
Correct |
26 ms |
3 KB |
answer is '6' |
8 |
Incorrect |
31 ms |
3 KB |
1.0 is not a valid integer |
9 |
Halted |
0 ms |
0 KB |
- |