logo AlgoBeat OnlineJudge
登录 注册

#212922. [NERC 2020 Online] Find a Square

内存限制:512 MiB 时间限制:6000 ms 标准输入输出
题目类型:VJudge(洛谷) 评测方式:VJudge
上传者: 匿名

题目描述

Frank likes square numbers. That is numbers, which are the product of some integer with itself. Also Frank likes quadratic polynomials. He even has his favorite one: .

This morning Frank evaluated his favorite quadratic polynomial for consecutive integer arguments starting from and multiplied all the numbers he got.

If the resulting product is a square, his day is just perfect, but that might be not the case. So he asks you to find the largest square number which is a divisor of the resulting product.

输入格式

The only line of the input contains 4 integers ().

输出格式

Find the largest square divisor of . As this number could be very large, output a single integer --- its remainder modulo .

样例

样例输入 1

1 1 1 10

样例输出 1

74529

样例输入 2

1 2 1 10

样例输出 2

189347824

数据范围与提示

In the first example, the product is equal to .