Grand Prix of Array Count
시간 제한1초메모리 제한2048 MB
길이 n이고 원소가 1부터 k까지인 배열 중, 합이 짝수인 모든 인덱스 쌍에서 gcd 조건을 만족하는 배열의 개수를 1e9+7로 나눈 나머지로 구한다. n과 k는 1e12까지다.
문제
An array of length is called funny if, for every pair of indices where , the following condition holds: if is an even number, then . For example, an array is funny.
You are given two positive integers and . Find the amount of funny arrays of length consisting only of integers between and . As this number may be very large, output it modulo .
입력
The only line contains two integers and (, ).
출력
Print a single number: the answer to the problem modulo .
힌트
In the first sample, there are funny arrays: , , , .