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. redis连接数据库进行操作

    该项目需要的类目录 1.首先我们需要创建我们的实体类 2.放置我们的dao层,在里面写入方法 3.配置类Appconfig需要加入我们的JdbcTemplate方法,因为我们用的是spring,所以需 ...

  2. 禁用Bootstrap点击空白,modal自动关闭

    手动触发modal:       $('#myModal').modal(): 禁用点击空白,modal自动关闭:$('#myModal').modal({backdrop: 'static', ke ...

  3. 如何使用sqlalchemy获取某年某月的数据总和

    代码如下: # 基于Flask的SQLAlchemy # models class History(db.Model): __tablename__ = 'historys' id = db.Colu ...

  4. win10 powershell 验证下载的包的MD5/sha1的签名值

    巧用Win10自带的PowerShell命令校验文件的Hash值(MD5.SHA1/256等) 发表于2017年3月8日由MS酋长 通常为了保证我们从网上下载的文件的完整性和可靠性,我们把文件下载下来 ...

  5. 转: java DES的算法片码

    转自: https://www.zhihu.com/question/36767829 作者:郭无心链接:https://www.zhihu.com/question/36767829/answer/ ...

  6. 字符设备之poll机制

    poll机制作用:相当于一个定时器.时间到了还没有资源就唤醒进程. 主要用途就是:进程设置一段时间用来等待资源,假设时间到了资源还没有到来,进程就立马从睡眠状态唤醒不再等待.当然这仅仅是使用于这段时间 ...

  7. Python中的列表,元组,字符串之间的相互转化

    Python中的列表元组和字符串之间的相互转化需要利用,tuple(),list(),str(). 示例如下: >>> the_string = "hello I'am x ...

  8. 【转载】在VS2008中使用WSE 3.0过程全记录

    WSE全称是Web Service Enhancement,提供了更好的安全性实现,以及大对象传输的设计. 有关WSE的一些介绍,如果不清楚,可以参考下面的链接 官方介绍:http://www.mic ...

  9. JavaScript-创建第一个自己的类库

    通过上一节面向对象和原型的学习. 我们知道了怎样创建一个类,包含类的私有化属性和方法.公有化属性和方法.静态属性和方法.在这里略微回想一下.首先要创建一个类能够通过1.new object().2.利 ...

  10. mysql最新版中文参考手册在线浏览

    MySQL是最流行的开放源码SQL数据库管理系统,具有快速.可靠和易于使用的特点.同时MySQL也是一种关联数据库管理系统,具有很高的响应速度和灵活性.又因为mysql拥有良好的连通性.速度和安全性, ...