Description
给定一个长为 n 的序列 a1,a2,...,an ,有 q 次查询,每次给定 l r ,求 φ(∏i=lrai) 对 998244353 取模的值。
Input
第一行输入 n 和 q 。
第二行输入 n 个数,第 i 个数表示 ai 。
接下来 q 行,每行读入两个数 l,r ,表示一组询问。
Output
对于每组询问,输出答案。
Samples
Constriants
本题开启 subtask 。
子任务1 (5分):1≤ai≤2 ,时间限制 3.5s ;
子任务2 (5分):1≤n,q≤3000,1≤ai≤1000 ,时间限制 3.5s;
子任务3 (10分):1≤n,q≤3000,1≤ai≤107 ,时间限制 3.5s;
子任务4 (30分):1≤n,q≤105,1≤ai≤107 ,时间限制 3.5s;
子任务5 (20分):1≤n,q≤106,1≤ai≤107 ,时间限制 6s ;
子任务6 (30分):1≤n,q≤106,1≤ai≤107 ,时间限制 3.5s 。