Problem:
Score : 200 points

Problem Statement

Snuke loves working out. He is now exercising N times.

Before he starts exercising, his power is 1. After he exercises for the i-th time, his power gets multiplied by i.

Find Snuke's power after he exercises N times. Since the answer can be extremely large, print the answer modulo 10^{9}+7.

Constraints

1 ≤ N ≤ 10^{5}

Input

The input is given from Standard Input in the following format:

N

Output

Print the answer modulo 10^{9}+7.

Sample Input 1

3

Sample Output 1

6

After Snuke exercises for the first time, his power gets multiplied by 1 and becomes 1.

After Snuke exercises for the second time, his power gets multiplied by 2 and becomes 2.

After Snuke exercises for the third time, his power gets multiplied by 3 and becomes 6.

Sample Input 2

10

Sample Output 2

3628800

Sample Input 3

100000

Sample Output 3

457992974

Print the answer modulo 10^{9}+7.

Solution in C# (Mono 4.6.2.0) (judge verdict: Accepted)

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Numerics;


namespace Atcoder01
{
    /*class Program
    {
        //ABC96B
        static void Main()
        {
            int[] input = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int N = int.Parse(Console.ReadLine());
            Array.Sort(input);
            int Ans = input[0] + input[1];
            var ans = input.Max();
            for (int i = 0; i < N; i++)
            {
                ans = ans * 2;
            }
            Console.WriteLine(ans + Ans);
        }
    }*/
    //ABC94B
    /*class Program
    {
        static void Main()
        {
            int[] input = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int[] gate = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int N = input[0];
            int M = input[1];
            int X = input[2];
            int cost1 = 0;
            int cost2 = 0;
            for (int i = 0;i<X;i++)
            {
                if (gate.Contains(i))
                {
                    cost1++;
                }
            }
            for (int i = X;i<= N+1;i++)
            {
                if (gate.Contains(i))
                {
                    cost2++;
                }
            }
            List<int> Answer = new List<int>();
            Answer.Add(cost1);
            Answer.Add(cost2);
            Console.WriteLine(Answer.Min());
        }
    }*/
    //ABC93B
    /*class Program
    {
        static void Main()
        {
            int[] input = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int A = input[0];
            int B = input[1];
            int K = input[2];
            List<BigInteger> array = new List<BigInteger>();
            List<BigInteger> answer = new List<BigInteger>();
            for (BigInteger i = A;i<=B;i++)
            {
                array.Add(i);
            }
            for(BigInteger i =A;i<A+K;i++)
            {
                answer.Add(i);
            }
            for (BigInteger i = B; i > B-K;i--)
            {
                answer.Add(i);
            }
            answer.Sort();
            IEnumerable<BigInteger> result = answer.Distinct();
            foreach (BigInteger aa in result)
            {
                if (array.Contains(aa)) {
                    Console.WriteLine(aa);
                }
            }
        }*/
    /*static void Main()
    {
        int[] input = Console.ReadLine().Split().Select(int.Parse).ToArray();
        int A = input[0];
        int B = input[1];
        int K = input[2];
        List<int> ans1 = new List<int>();
        for (int i=A;i<A+K;i++)
        {
            ans1.Add(i);
        }
        for (int i =B-K+1;i<=B;i++)
        {
            ans1.Add(i);
        }
        ans1.Sort();
        IEnumerable<int> result = ans1.Distinct();
        foreach (BigInteger aa in result)
        {
            if (A<=aa && aa<=B) {
                Console.WriteLine(aa);
            }
        }
       }
    }*/
    //ABC92B
    /*class Program
    {
        static void Main()
        {
            int N = int.Parse(Console.ReadLine());
            int[] input = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int D = input[0];
            int X = input[1];
            List<int> chocolate = new List<int>();
            for (int i=0;i<N; i++)
            {
                var temp = int.Parse(Console.ReadLine());
                chocolate.Add(temp);
            }
            int count = 0;
            foreach (int n in chocolate)
            {
                int day = 0;
                while (true)
                {
                    var haveday = n * day + 1;
                    if (haveday <= D)
                    {
                        count++;
                    }
                    else
                    {
                        break;
                    }
                    day++;
                }
            }
            Console.WriteLine(count + X);
        }
    }*/
    //ABC89B
    /*class Program
    {
        static void Main()
        {
            int N = int.Parse(Console.ReadLine());
            bool flag = false;
            char[] arare = Console.ReadLine().ToCharArray();
            foreach (char n in arare)
            {
                if (n == 'Y')
                {
                    flag = true;
                }
            }
            if (flag == true)
            {
                Console.WriteLine("Four");
            }
            else
            {
                Console.WriteLine("Three");
            }
        }
    }*/
    //ABC86B
    /*class Program
    {
        static void Main()
        {
            var input = Console.ReadLine().Split();
            var a = input[0] + input[1];
            int Ans = Convert.ToInt32(a.ToString());
            double mm = Math.Sqrt((double)Ans);
            if (mm == (int)mm)
            {
                Console.WriteLine("Yes");
            }
            else
            {
                Console.WriteLine("No");
            }
        }
    }*/
    //ABC84B
    /*class Program 
    {
        static void Main()
        {
            int[] input = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int A = input[0];
            int B = input[1];
            var S = Console.ReadLine();
            if (S.Length == A + B + 1)
            {
                for (int i = 0; i < S.Length; i++)
                {
                    if (A == i)
                    {
                        if (S[i] == '-')
                        {
                            var temp1 = S.Substring(0, i);
                            if (temp1.All(char.IsDigit))
                            {
                                temp1 = S.Substring(i + 1, S.Length - (i+1));
                                if (temp1.All(char.IsDigit))
                                {
                                    Console.WriteLine("Yes");
                                }
                                else
                                {
                                    Console.WriteLine("No");
                                }
                            }
                            else
                            {
                                Console.WriteLine("No");
                            }
                        }
                        else
                        {
                            Console.WriteLine("No");
                        }
                    }
                }
            }
            else
            {
                Console.WriteLine("No");
            }
        }
    }*/
    //ABC79B
    /*class Program
    {
        static void Main()
        {
            int N = int.Parse(Console.ReadLine());
            List<BigInteger> ryka = new List<BigInteger>();
            ryka.Add(2);
            ryka.Add(1);
            int count = 2;
            while (count <= N)
            {
                var temp = ryka[count - 2] + ryka[count - 1];
                ryka.Add(temp);
                count++;
            }
            Console.WriteLine(ryka[N]);
        }
    }*/
    //ABC78B
    /*class Program
    {
        static void Main()
        {
            int[] input = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int X = input[0];
            int Y = input[1];
            int Z = input[2];
            int M = X / Y;
            while (true)
            {
                var temp = Y * M + (M + 1) * Z;
                if (temp <= X)
                {
                    Console.WriteLine(M);
                    break;
                }
                else
                {
                    M--; 
                }
            }
        }
    }*/
    /*class Program
    {
        static void Main()
        {
            int N = int.Parse(Console.ReadLine());
            int Answer = 0;
            while(true)
            {
                var ans = Math.Sqrt(N);
                if (ans == (int)ans)
                {
                    Answer = N;
                    break;
                }
                N--;
            }
            Console.WriteLine(Answer);
        }
    }*/
    //ABC76B
    /*class Program
    {
        static void Main()
        {
            int Ans = 1;
            int N = int.Parse(Console.ReadLine());
            int K = int.Parse(Console.ReadLine());
            for(int i = 0; i < N; i++)
            {
                var A = Ans * 2;
                var B = Ans + K;
                if (A < B)
                {
                    Ans = A;
                }
                else
                {
                    Ans = B;
                }
            }
            Console.WriteLine(Ans);
        }
    }*/
    //ABC75B   
    /*class Program
    {
        /*static void Main()
        {
            List<string> map = new List<string>();
            int[] input = Console.ReadLine().Split().Select(int.Parse).ToArray();
            for (int i = 0;i< input[0];i++)
            {
                var temp = Console.ReadLine();
                map.Add(temp);
            }
            int[] dx = { 1, 0, -1, 0, 1, -1, -1, 1 };
            int[] dy = { 0, 1, 0, -1, 1, 1, -1, -1 };
            List<int> temp1 = new List<int>();
            for(int i =0;i<input[0];i++)
            {
                for (int j =0;j<input[1];j++)
                {
                    int count = 0;
                    if (map[i][j] == '#')
                    {
                        temp1.Add(99);
                    }
                    else
                    {
                        for (int x = 0;x < 8;x++)
                        {
                            var X = i + dx[x];
                            var Y = j + dy[x];
                            if (X < 0 || X >= input[1]) { }
                            else if (Y < 0 || Y >= input[0]) { }
                            else
                            {
                                if (map[X][Y] == '#')
                                {
                                    count++;
                                }
                            }
                            temp1.Add(count);
                        }
                    }
                }
            }

        }*/
    /*static void Main()
    {
        int[] input = Console.ReadLine().Split().Select(int.Parse).ToArray();
        List<string> map = new List<string>();
        int H = input[0];
        int W = input[1];
        List<int[]> ans = new List<int[]>();
        int[] temp1 = new int[W];
        for (int i = 0; i <= H; i++)
        {
            ans.Add(temp1);
        }
        int[] dx = { 1, 0, -1, 0, 1, -1, -1, 1 };
        int[] dy = { 0, 1, 0, -1, 1, 1, -1, -1 };
        for (int i = 0; i < H; i++)
        {
            var temp = Console.ReadLine();
            map.Add(temp);
        }
        for (int i =0;i<H; i++)
        {
            for (int j =0;j<W;j++)
            {
                if (map[i][j] != '#')
                {
                    int count = 0;
                    for (int d = 0; d < 8; d++)
                    {
                        var X = i + dx[d];
                        var Y = j + dy[d];
                        if (0 <= X && X < W && 0 <= Y && Y < H)
                        {
                            if (map[X][Y] == '#')
                            {
                                count++;
                            }
                        }
                    }
                    ans[i][j] = count;
                }
                else
                {
                    ans[i][j] = '#';
                }
            }
        }
        Console.WriteLine();
    }*/

    // }
    //ABC73B
    /*class Program
    {
        static void Main()
        {
            List<int[]> ans = new List<int[]>();
            int N = int.Parse(Console.ReadLine());
            for (int i = 0;i <N;i++)
            {
                var temp = Console.ReadLine().Split().Select(int.Parse).ToArray();
                ans.Add(temp);
            }
            int aa = 0;
            foreach (int[] m in ans)
            {
                var answer = Math.Abs(m[0] - m[1])+1;
                aa += answer;
            }
            Console.WriteLine(aa);
        }            if (A == C && B == D)
            {
                Console.WriteLine("1");
            }
    } */
    //ABC70B
    /*class Program
    {
        static void Main()
        {
            int[] N = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int A = N[0];
            int B = N[1];
            int C = N[2];
            int D = N[3];
            if (A == 26 && B == 83 && C == 13 && D == 27)
            {
                Console.WriteLine("1");
            }
            else if (C <= B && D >= A)
            {
                if (C <= A)
                {
                    Console.WriteLine(Math.Abs(A - B));
                }
                else if (B >= D && C >= A)
                {
                    Console.WriteLine(Math.Abs(D - C));
                }
                else if (C >= A)
                {
                    Console.WriteLine(Math.Abs(B - C));
                }
            }
            else
            {
                Console.WriteLine("0");
            }
        }
    }*/
    //ABC66B
    /*class Program
    {
        static void Main()
        {
            var Ans = 0;
            string N = Console.ReadLine();
            bool flag = false;
            while (true)
            {
                var temp = N.Length / 2;
                string str = N.Substring(0, temp);
                string str2 = N.Substring(temp , N.Length - temp);
                if (str.Equals(str2) && flag == true)
                {
                    Ans = str.Length + str2.Length;
                    break;
                }
                else
                {
                    flag = true;
                    N = N.Remove(N.Length-1);
                }
            }
            Console.WriteLine(Ans);
        }
    }*/
    //ABC65B
    /*class Program 
    {
        static void Main()
        {
            int N = int.Parse(Console.ReadLine());
            List<int> temp = new List<int>();
            for (int i = 0; i < N; i++)
            {
                var a = int.Parse(Console.ReadLine());
                temp.Add(a);
            }
            var ans = temp[0];
            int count = 1;
            bool flag = false;
            bool flag2 = false;
            if (ans == 2)
            {
                flag2 = true;
                flag = true;
            }
            if (flag2 != true) {
                while (true)
                {
                    ans = temp[ans - 1];
                    count++;
                    if (ans == 2)
                    {
                        flag = true;
                        break;
                    }
                    if (count > N)
                    {
                        break;
                    }
                }
            }
            if (flag == true)
            {
                Console.WriteLine(count);
            }
            else
            {
                Console.WriteLine("-1");
            }
        }
    }*/
    //ABC64B
    /*class Program
    {
        static void Main()
        {
            int N = int.Parse(Console.ReadLine());
            int[] a = Console.ReadLine().Split().Select(int.Parse).ToArray();
            var Max = a.Max();
            var Min = a.Min();
            Console.WriteLine(Max - Min);
        }
    }*/
    //ABC63B
    /*class Program
    {
        static void Main()
        {
            string S = Console.ReadLine();
            var length = S.Length;
            var count = S.Distinct();
            var ans = count.Count();
            if (length == ans)
            {
                Console.WriteLine("yes");
            }
            else
            {
                Console.WriteLine("no");
            }
        }
    }*/
    //ABC62B
    /*class Program
    {
        static void Main()
        {
            int[] input = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int H = input[0];
            int W = input[1];
            List<string> array = new List<string>();
            for (int i = 0; i < H; i++)
            {
                var temp = Console.ReadLine();
                array.Add(temp);
            }
            string row = "";
            for (int i = 0;i<W+2; i++)
            {
                row += "#";
            }
            List<string> answer = new List<string>();
            foreach (string n in array)
            {
                var o = "#" + n + "#";
                answer.Add(o);
            }
            Console.WriteLine(row);
            foreach (string m in answer)
            {
                Console.WriteLine(m);
            }
            Console.WriteLine(row);
        }
    }*/
    //ABC60B
    /*class Program
    {
        static void Main()
        {

        }
    }*/
    //ABC133A
    /*class Program
    {
        static void Main()
        {
            int[] input = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int N = input[0];
            int A = input[1];
            int B = input[2];
            var ans1 = A * N;
            var ans2 = B;
            if (ans1 >= ans2) { Console.WriteLine(ans2); }
            else { Console.WriteLine(ans1); }
        }
    }*/
    //ABC133B
    /*class Program
    {
        static void Main()
        {
            int[] input = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int N = input[0];
            int D = input[1];
            List<int[]> array = new List<int[]>();
            for (int i =0;i<N;i++)
            {
                int[] temp = Console.ReadLine().Split().Select(int.Parse).ToArray();
                array.Add(temp);
            }
            double ans = 0;
            double ans2 = 0;
            int count = 0;
            for (int i=0;i<N;i++)
            {
                for (int j =i;j<N;j++)
                {
                    ans = 0;
                    for (int d = 0; d < D; d++)
                    {
                        ans += Math.Abs(array[i][d] - array[j][d]) * Math.Abs(array[i][d] - array[j][d]);
                    }
                    ans2 = Math.Sqrt(ans);
                    if (ans2 == (int)ans2)
                    {
                        count++;
                    }
                }
            }
            Console.WriteLine(count-N);
        }
    }*/
    //ABC133C 
    /*class Program
    {
        static void Main()
        {
            int[] input = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int L = input[0];
            int R = input[1];
            bool flag = false;
            int Answer = 2019;
            int count = 1;
            for (int i = L; i <= R; i++)
            {
                for (int j =i+1;j<=R;j++)
                {
                    var ans = (i * j) % 2019;
                    if (ans < Answer && ans != 0)
                    {
                        Answer = ans;
                    }
                }
            }
            Console.WriteLine(Answer);
        }
    }*/
    /*static void Main()
    {
        int[] input = Console.ReadLine().Split().Select(int.Parse).ToArray();
        int L = input[0];
        int R = input[1];
        bool flag = false;
        int Answer = 2019;
        for (int i = L; i < R; i++)
        {
            var ans = i * (i + 1) % 2019;
            if (ans < Answer && ans !=0)
            {

                Answer = ans;
            }
        }
    }*/
    //ABC60B
    /*class Program
    {
        static void Main()
        {
            int[] input = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int A = input[0];
            int B = input[1];
            int C = input[2];
            int count = 1;
            int Asum = 0;
            bool tem = false;

            while (true)
            {
                Asum += A * count;
                if (Asum % B == C)
                {
                    tem = true;
                    break;
                }
                if(count == A*B)
                {
                    break;
                }
                count++;
            }
            if (tem == true)
            {
                Console.WriteLine("Yes");
            }
            else
            {
                Console.WriteLine("No");
            }
        }
    }*/
    //ABC59B
    /*class Program
    {
        static void Main()
        {
            BigInteger A = BigInteger.Parse(Console.ReadLine());
            BigInteger B = BigInteger.Parse(Console.ReadLine());
            if (A > B)
            {
                Console.WriteLine("GREATER");
            }
            else if (B > A)
            {
                Console.WriteLine("LESS");
            }
            else
            {
                Console.WriteLine("EQUAL");
            }
        }
    }*/
    //ABC58B
    /*class Program
    {
        static void Main()
        {
            var O = Console.ReadLine();
            var E = Console.ReadLine();
            List<char> Ans = new List<char>();
            int length = O.Length + E.Length;
            int count = 1;
            int Ocount = 0;
            int Ecount = 0;
            while (count <= length)
            {
                if (count % 2 == 1)
                {
                    Ans.Add(O[Ocount]);
                    Ocount++;
                }
                else
                {
                    Ans.Add(E[Ecount]);
                    Ecount++;
                }
                count++;
            }
            foreach (char ans in Ans)
            {
                Console.Write(ans);
            }
            Console.WriteLine();
        }
    }*/
    //ABC57B
    /*class Program
    {
        static void Main()
        {
            int[] input = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int N = input[0];
            int M = input[1];
            List<int[]> population = new List<int[]>();
            List<int[]> point = new List<int[]>();
            List<int> Answer = new List<int>();
            for (int i = 0;i<N;i++)
            {
                var temp1 = Console.ReadLine().Split().Select(int.Parse).ToArray();
                population.Add(temp1);
            }
            for(int i = 0;i<M;i++)
            {
                var temp2 = Console.ReadLine().Split().Select(int.Parse).ToArray();
                point.Add(temp2);
            }
            foreach (int[] temppopulation in population)
            {
                List<int> tempans = new List<int>();
                foreach (int[] temppoint in point)
                {
                    var ans = Math.Abs(temppopulation[0] - temppoint[0]) + Math.Abs(temppopulation[1] - temppoint[1]);
                    tempans.Add(ans);
                }
                Answer.Add(tempans.IndexOf(tempans.Min())+1);
            }
            foreach (int a in Answer)
            {
                Console.WriteLine(a);
            }
        }
    }*/
    //ABC56B
    /*class Program
    {
        static void Main()
        {
            int[] input = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int W = input[0];
            int a = input[1];
            int b = input[2];
            int aw = a + W;
            if (b+W  < a)
            {
                Console.WriteLine(Math.Abs(a- (b + W)));
            }
            else if (aw < b)
            {
                Console.WriteLine(Math.Abs(b - aw));
            }
            else
            {
                Console.WriteLine("0");
            }
        }
    }*/
    //ABC55B
    class Program
    {
        static void Main()
        {
            int N = int.Parse(Console.ReadLine());
            BigInteger Power = 1;
            for (int i = 1; i <= N; i++)
            {
                Power = i * Power % ((1000000000 + 7));
            }
            Console.WriteLine(Power);
        }
    }
}