Holidays have finished. Thanks to the help of the hacker Leha, Noora managed to enter the university of her dreams which is located in a town Pavlopolis. It's well known that universities provide students with dormitory for the period of university studies. Consequently Noora had to leave Vičkopolis and move to Pavlopolis. Thus Leha was left completely alone in a quiet town Vičkopolis. He almost even fell into a depression from boredom!

Leha came up with a task for himself to relax a little. He chooses two integers Aand B and then calculates the greatest common divisor of integers "A factorial" and "B factorial". Formally the hacker wants to find out GCD(A!, B!). It's well known that the factorial of an integer x is a product of all positive integers less than or equal to x. Thus x! = 1·2·3·...·(x - 1)·x. For example 4! = 1·2·3·4 = 24. Recall that GCD(x, y) is the largest positive integer q that divides (without a remainder) both x and y.

Leha has learned how to solve this task very effective. You are able to cope with it not worse, aren't you?

Input

The first and single line contains two integers A and B (1 ≤ A, B ≤ 109, min(A, B) ≤ 12).

Output

Print a single integer denoting the greatest common divisor of integers A! and B!.

Example

Input
4 3
Output
6

Note

Consider the sample.

4! = 1·2·3·4 = 24. 3! = 1·2·3 = 6. The greatest common divisor of integers 24 and 6is exactly 6.

 #include<bits/stdc++.h>
using namespace std; int main() {
long long nums;
long long a,b;
cin>>a>>b;
long long c = min(a,b);
long long d = max(a,b);
long long sum = ;
if(c == )
sum = ;
for(long long i = c; i > ; i--)
{ sum *= i;
} cout<<sum<<endl;
return ;
}

A - I'm bored with life的更多相关文章

  1. Codeforces822 A I'm bored with life

    A. I'm bored with life time limit per test 1 second memory limit per test 256 megabytes input standa ...

  2. Codeforces Round #422 (Div. 2) A. I'm bored with life 暴力

    A. I'm bored with life     Holidays have finished. Thanks to the help of the hacker Leha, Noora mana ...

  3. By virtue of|sustain|post |scrape off |stretch|access to|take into account of|exploit|hasten|blur |idle|bored her to|account for|accused of|cruelty

    By virtue of this superior quality, this product is often sold out of stockin many areas. 我们的产品因其优秀的 ...

  4. bored

    https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemid=8&page=show_probl ...

  5. [思维题]Bored Qishen

    给出一个整数集,其中包含1-n的所有整数,要求挑选出一个元素最多的子集,使得子集中任意两数的乘积不是完全平方数 (n<=10^6) 求这样一个最大子集的元素个数 #include <cst ...

  6. Gym 101102C Bored Judge(set--结构体集合)

    这个故事告诉我们,WA了一定要找自己的原因... ... 当我开始用set去做的时候,发现一直过不去,一开始忘了把初始排名加进去,后来忘了第0秒,第0秒第一的id = 1 这个题目的做法也不只这一种, ...

  7. 【Codeforces Round #422 (Div. 2) A】I'm bored with life

    [题目链接]:http://codeforces.com/contest/822/problem/A [题意] 让你求a!和b!的gcd min(a,b)<=12 [题解] 哪个小就输出那个数的 ...

  8. Programming Learning - Based on Project

    Today when taking a bath I got a good idea that it is an efficient and interesting way to learn a ne ...

  9. Codeforces Round #384 (Div. 2) 734E Vladik and cards

    E. Vladik and cards time limit per test 2 seconds memory limit per test 256 megabytes input standard ...

随机推荐

  1. win10安装mysql5.6,mysql启动时,闪退

    首先在服务中查看是不是mysql启动了 发现在服务中没有mysql服务, 然后找到mysql的安装目录 MYSQL SERVER 5.6 中将my-default.ini 改为my.ini 使用命令行 ...

  2. Eclipse注释模板配置

    不过感觉作用不大,因为@date这些不是标准的Java注释.

  3. Mark 创建路径(c#)-动态分段

    http://bbs.esrichina-bj.cn/ESRI/viewthread.php?action=printable&tid=128564 public void CreateRou ...

  4. B-Tree 索引和 Hash 索引的对照

    对于 B-tree 和 hash 数据结构的理解可以有助于预測不同存储引擎下使用不同索引的查询性能的差异.尤其是那些同意你选择 B-tree 或者 hash 索引的内存存储引擎. B-Tree 索引的 ...

  5. [wxWidgets]_[0基础]_[不常见但有用的类wxCmdLineParser]

    场景: 1. 有时候须要构造命令行字符串传递給函数调用,比方CreateProcess,假设參数是动态的,那么就得使用类似std::vector<string>加入单个參数,之后拼接为一个 ...

  6. performSelector调用和直接调用的区别

    今天在准备出笔试题的过程中随便搜了一下其他的笔试题,看到其中一个就是关于performSelector与直接调用的区别. 个人感觉这其实是一个陷阱题,因为大部分应用场景下,用哪一种都可以,可以说是没有 ...

  7. random模块的使用

    random模块用于生成随机数 import random print random.random() #用于生成小于1大于0的数 print random.randint(1,5) #生成大于等于1 ...

  8. java-组合优于继承

    组合和继承.都能实现对类的扩展. 差别例如以下表所看到的 组合 继承 has-a关系 is-a关系 执行期决定 编译期决定 不破坏封装,总体和局部松耦合 破坏封装,子类依赖父类 支持扩展,任意添加组合 ...

  9. ZrcListView

    https://github.com/zarics/ZrcListView

  10. JS之RegExp对象(二)

    版权声明:本文为博主原创文章.未经博主同意不得转载. https://blog.csdn.net/zkn_CS_DN_2013/article/details/24243159 RegExp对象的经常 ...