A pair (p, q) of integer numbers is called Rasta - lover if and only if 1 ≤ p, q < n and there is a positive integer like x such that:
px ≡ q (modn)
Subtasks 1 - 3:
Given n, calculate the number of Rasta - lover pairs modulo 109 + 7.
Subtasks 4 - 6:
A positive integer p is called n - Rastaly if and only if p < n and there is a positive integer like x such that px ≡ 1 (modn) and p and n are coprimes.
For a positive integer n, f(n) is the smallest positive integer a such that for each n - Rastaly number like p, pa ≡ 1 (modn) (this number always exists).
If M is equal to
for a given A, then you have to calculate M modulo 109 + 7.
Subtasks:
Each subtask consists of one testcase.
Input consists of one number. For subtasks 1-3, it's n and for subtasks 4-6 it's A.
Print the answer modulo 109 + 7 in one line.
A pair (p, q) of integer numbers is called Rasta - lover if and only if 1 ≤ p, q < n and there is a positive integer like x such that:
px ≡ q (modn)
Subtasks 1 - 3:
Given n, calculate the number of Rasta - lover pairs modulo 109 + 7.
Subtasks 4 - 6:
A positive integer p is called n - Rastaly if and only if p < n and there is a positive integer like x such that px ≡ 1 (modn) and p and n are coprimes.
For a positive integer n, f(n) is the smallest positive integer a such that for each n - Rastaly number like p, pa ≡ 1 (modn) (this number always exists).
If M is equal to
for a given A, then you have to calculate M modulo 109 + 7.
Subtasks:
Each subtask consists of one testcase.
Input consists of one number. For subtasks 1-3, it's n and for subtasks 4-6 it's A.
Print the answer modulo 109 + 7 in one line.
A pair (p, q) of integer numbers is called Rasta - lover if and only if 1 ≤ p, q < n and there is a positive integer like x such that:
px ≡ q (modn)
Subtasks 1 - 3:
Given n, calculate the number of Rasta - lover pairs modulo 109 + 7.
Subtasks 4 - 6:
A positive integer p is called n - Rastaly if and only if p < n and there is a positive integer like x such that px ≡ 1 (modn) and p and n are coprimes.
For a positive integer n, f(n) is the smallest positive integer a such that for each n - Rastaly number like p, pa ≡ 1 (modn) (this number always exists).
If M is equal to
for a given A, then you have to calculate M modulo 109 + 7.
Subtasks:
Each subtask consists of one testcase.
Input consists of one number. For subtasks 1-3, it's n and for subtasks 4-6 it's A.
Print the answer modulo 109 + 7 in one line.
A pair (p, q) of integer numbers is called Rasta - lover if and only if 1 ≤ p, q < n and there is a positive integer like x such that:
px ≡ q (modn)
Subtasks 1 - 3:
Given n, calculate the number of Rasta - lover pairs modulo 109 + 7.
Subtasks 4 - 6:
A positive integer p is called n - Rastaly if and only if p < n and there is a positive integer like x such that px ≡ 1 (modn) and p and n are coprimes.
For a positive integer n, f(n) is the smallest positive integer a such that for each n - Rastaly number like p, pa ≡ 1 (modn) (this number always exists).
If M is equal to
for a given A, then you have to calculate M modulo 109 + 7.
Subtasks:
Each subtask consists of one testcase.
Input consists of one number. For subtasks 1-3, it's n and for subtasks 4-6 it's A.
Print the answer modulo 109 + 7 in one line.
A pair (p, q) of integer numbers is called Rasta - lover if and only if 1 ≤ p, q < n and there is a positive integer like x such that:
px ≡ q (modn)
Subtasks 1 - 3:
Given n, calculate the number of Rasta - lover pairs modulo 109 + 7.
Subtasks 4 - 6:
A positive integer p is called n - Rastaly if and only if p < n and there is a positive integer like x such that px ≡ 1 (modn) and p and n are coprimes.
For a positive integer n, f(n) is the smallest positive integer a such that for each n - Rastaly number like p, pa ≡ 1 (modn) (this number always exists).
If M is equal to
for a given A, then you have to calculate M modulo 109 + 7.
Subtasks:
Each subtask consists of one testcase.
Input consists of one number. For subtasks 1-3, it's n and for subtasks 4-6 it's A.
Print the answer modulo 109 + 7 in one line.
A pair (p, q) of integer numbers is called Rasta - lover if and only if 1 ≤ p, q < n and there is a positive integer like x such that:
px ≡ q (modn)
Subtasks 1 - 3:
Given n, calculate the number of Rasta - lover pairs modulo 109 + 7.
Subtasks 4 - 6:
A positive integer p is called n - Rastaly if and only if p < n and there is a positive integer like x such that px ≡ 1 (modn) and p and n are coprimes.
For a positive integer n, f(n) is the smallest positive integer a such that for each n - Rastaly number like p, pa ≡ 1 (modn) (this number always exists).
If M is equal to
for a given A, then you have to calculate M modulo 109 + 7.
Subtasks:
Each subtask consists of one testcase.
Input consists of one number. For subtasks 1-3, it's n and for subtasks 4-6 it's A.
Print the answer modulo 109 + 7 in one line.
Sequence
of positive integers is given to you. A sequence of positive integers is called Rasta - made if and only if every two consecutive elements from this sequence are coprimes to each other.
A Rasta - making operation on a sequence consists of choosing two non-coprime consecutive elements from it and divide them both by one of their common prime factors. For example, we can turn the seqeunce
to
with performing one operation.
Phoulady number of a sequence is the minimum number of Rasta - making operations needed for turning it into a Rasta - made sequence.
Construction number of a a sequence is the number of different sequences we can get by performing 0 or more Rasta - making operations.
We show Phoulady number by F and Construction number by S.
In all subtasks:
Subtasks:
Each subtask consists of one testcase.
Input consists of two integers, n and M.
Print the answer modulo 109 + 7 in a single line.
Sequence
of positive integers is given to you. A sequence of positive integers is called Rasta - made if and only if every two consecutive elements from this sequence are coprimes to each other.
A Rasta - making operation on a sequence consists of choosing two non-coprime consecutive elements from it and divide them both by one of their common prime factors. For example, we can turn the seqeunce
to
with performing one operation.
Phoulady number of a sequence is the minimum number of Rasta - making operations needed for turning it into a Rasta - made sequence.
Construction number of a a sequence is the number of different sequences we can get by performing 0 or more Rasta - making operations.
We show Phoulady number by F and Construction number by S.
In all subtasks:
Subtasks:
Each subtask consists of one testcase.
Input consists of two integers, n and M.
Print the answer modulo 109 + 7 in a single line.
Sequence
of positive integers is given to you. A sequence of positive integers is called Rasta - made if and only if every two consecutive elements from this sequence are coprimes to each other.
A Rasta - making operation on a sequence consists of choosing two non-coprime consecutive elements from it and divide them both by one of their common prime factors. For example, we can turn the seqeunce
to
with performing one operation.
Phoulady number of a sequence is the minimum number of Rasta - making operations needed for turning it into a Rasta - made sequence.
Construction number of a a sequence is the number of different sequences we can get by performing 0 or more Rasta - making operations.
We show Phoulady number by F and Construction number by S.
In all subtasks:
Subtasks:
Each subtask consists of one testcase.
Input consists of two integers, n and M.
Print the answer modulo 109 + 7 in a single line.
Due to the cruelties of Mike, Rastas attacked his country (to help its people of course) and they're moving forward to the capital.
Rastas' army has 2n - 1 soldiers and the strength of soldier number i is the number of set bits (bits equal to 1) in binary representation of number i (soldiers are numbered from 1 to 2n - 1).
If the greatest common divisor of numbers a and b is gcd(a, b), we know that strength of this army which we show with S is equal to:

As the minister of Mike, it's your duty to calculate S modulo 109 + 7.
Subtasks:
Each subtask consists of one testcase.
Input consists of one integer, n.
Print the answer modulo 109 + 7 in a single line.
Due to the cruelties of Mike, Rastas attacked his country (to help its people of course) and they're moving forward to the capital.
Rastas' army has 2n - 1 soldiers and the strength of soldier number i is the number of set bits (bits equal to 1) in binary representation of number i (soldiers are numbered from 1 to 2n - 1).
If the greatest common divisor of numbers a and b is gcd(a, b), we know that strength of this army which we show with S is equal to:

As the minister of Mike, it's your duty to calculate S modulo 109 + 7.
Subtasks:
Each subtask consists of one testcase.
Input consists of one integer, n.
Print the answer modulo 109 + 7 in a single line.
Due to the cruelties of Mike, Rastas attacked his country (to help its people of course) and they're moving forward to the capital.
Rastas' army has 2n - 1 soldiers and the strength of soldier number i is the number of set bits (bits equal to 1) in binary representation of number i (soldiers are numbered from 1 to 2n - 1).
If the greatest common divisor of numbers a and b is gcd(a, b), we know that strength of this army which we show with S is equal to:

As the minister of Mike, it's your duty to calculate S modulo 109 + 7.
Subtasks:
Each subtask consists of one testcase.
Input consists of one integer, n.
Print the answer modulo 109 + 7 in a single line.