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 Rust (1.15.1) (judge verdict: Accepted)

macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

// ---------- begin ModInt ----------
const MOD: u32 = 1_000_000_007;

#[derive(Clone, Copy)]
pub struct ModInt(u32);

impl std::ops::Add for ModInt {
    type Output = ModInt;
    fn add(self, other: ModInt) -> ModInt {
        let mut v = self.0 + other.0;
        if v >= MOD {
            v %= MOD;
        }
        ModInt(v)
    }
}

impl std::ops::AddAssign for ModInt {
    fn add_assign(&mut self, other: ModInt) {
        *self = *self + other;
    }
}

impl std::ops::Sub for ModInt {
    type Output = ModInt;
    fn sub(self, other: ModInt) -> ModInt {
        let mut v = self.0 + MOD - other.0;
        if v >= MOD {
            v -= MOD;
        }
        ModInt(v)
    }
}

impl std::ops::SubAssign for ModInt {
    fn sub_assign(&mut self, other: ModInt) {
        *self = *self - other;
    }
}

impl std::ops::Mul for ModInt {
    type Output = ModInt;
    fn mul(self, other: ModInt) -> ModInt {
        ModInt((self.0 as u64 * other.0 as u64 % MOD as u64) as u32)
    }
}

impl std::ops::MulAssign for ModInt {
    fn mul_assign(&mut self, other: ModInt) {
        *self = *self * other;
    }
}

impl std::ops::Neg for ModInt {
    type Output = ModInt;
    fn neg(self) -> ModInt {
        ModInt(if self.0 == 0 { 0 } else { MOD - self.0 })
    }
}

impl std::fmt::Display for ModInt {
    fn fmt<'a>(&self, f: &mut std::fmt::Formatter<'a>) -> std::fmt::Result {
        write!(f, "{}", self.0)
    }
}

impl std::str::FromStr for ModInt {
    type Err = std::num::ParseIntError;
    fn from_str(s: &str) -> Result<ModInt, Self::Err> {
        let val = s.parse::<u32>()?;
        Ok(ModInt::new(val))
    }
}

impl From<usize> for ModInt {
    fn from(v: usize) -> ModInt {
        ModInt((v % MOD as usize) as u32)
    }
}

impl From<u8> for ModInt {
    fn from(v: u8) -> ModInt {
        ModInt(v as u32 % MOD)
    }
}

impl From<u16> for ModInt {
    fn from(v: u16) -> ModInt {
        ModInt(v as u32 % MOD)
    }
}

impl From<u32> for ModInt {
    fn from(v: u32) -> ModInt {
        ModInt(v % MOD)
    }
}

impl From<u64> for ModInt {
    fn from(v: u64) -> ModInt {
        ModInt((v % MOD as u64) as u32)
    }
}

impl From<isize> for ModInt {
    fn from(v: isize) -> ModInt {
        ModInt((v as i32 % MOD as i32 + MOD as i32) as u32)
    }
}

impl From<i8> for ModInt {
    fn from(v: i8) -> ModInt {
        ModInt((v as i32 % MOD as i32 + MOD as i32) as u32)
    }
}

impl From<i16> for ModInt {
    fn from(v: i16) -> ModInt {
        ModInt((v as i32 % MOD as i32 + MOD as i32) as u32)
    }
}

impl From<i32> for ModInt {
    fn from(v: i32) -> ModInt {
        ModInt((v % MOD as i32 + MOD as i32) as u32)
    }
}

impl From<i64> for ModInt {
    fn from(v: i64) -> ModInt {
        ModInt((v % MOD as i64 + MOD as i64) as u32)
    }
}

pub trait ModIntNew<T> {
    fn new(n: T) -> ModInt;
}

impl ModIntNew<usize> for ModInt {
    fn new(n: usize) -> ModInt {
        ModInt(ModInt::from(n).0 % MOD)
    }
}

impl ModIntNew<u8> for ModInt {
    fn new(n: u8) -> ModInt {
        ModInt(ModInt::from(n).0 % MOD)
    }
}

impl ModIntNew<u16> for ModInt {
    fn new(n: u16) -> ModInt {
        ModInt(ModInt::from(n).0 % MOD)
    }
}

impl ModIntNew<u32> for ModInt {
    fn new(n: u32) -> ModInt {
        ModInt(ModInt::from(n).0 % MOD)
    }
}

impl ModIntNew<u64> for ModInt {
    fn new(n: u64) -> ModInt {
        ModInt(ModInt::from(n).0 % MOD)
    }
}

impl ModIntNew<isize> for ModInt {
    fn new(n: isize) -> ModInt {
        ModInt(ModInt::from(n).0 % MOD)
    }
}

impl ModIntNew<i8> for ModInt {
    fn new(n: i8) -> ModInt {
        ModInt(ModInt::from(n).0 % MOD)
    }
}

impl ModIntNew<i16> for ModInt {
    fn new(n: i16) -> ModInt {
        ModInt(ModInt::from(n).0 % MOD)
    }
}

impl ModIntNew<i32> for ModInt {
    fn new(n: i32) -> ModInt {
        ModInt(ModInt::from(n).0 % MOD)
    }
}

impl ModIntNew<i64> for ModInt {
    fn new(n: i64) -> ModInt {
        ModInt(ModInt::from(n).0 % MOD)
    }
}

#[allow(dead_code)]
impl ModInt {
    pub fn zero() -> ModInt {
        ModInt(0)
    }

    pub fn one() -> ModInt {
        ModInt(1)
    }

    pub fn pow(self, mut n: u32) -> ModInt {
        let mut t = ModInt::one();
        let mut s = self;
        while n > 0 {
            if n & 1 == 1 {
                t *= s;
            }
            s *= s;
            n >>= 1;
        }
        t
    }

    pub fn inv(self) -> ModInt {
        assert!(self.0 > 0);
        self.pow(MOD - 2)
    }
}
// ---------- end ModInt ----------------
fn main() {
    input! {
        n: u32,
    };
    println!(
        "{}",
        (1..n + 1)
            .map(|x| ModInt::from(x))
            .fold(ModInt::new(1), |acc, x| acc * x)
    );
}