Factorial equations

3.4

57 votes
Mathematics, Modulus Arithmetic, Math, Number Theory
Problem

You are given two numbers X and N. Your task is to find the last digit of the following equation: 
X((N!)÷mod 10)

Input format

The first line contains two integers X and N.

Output format

Print the last digit of the given equation.

Constraints

1X1090N1018

Time Limit: 1
Memory Limit: 256
Source Limit:
Explanation

factorial of (2) is 2*1=2  ,So 5^2=25 the last digit in 25 is 5

Editor Image

?