Inclusion-Exclusion

5

1 votes
Easy-Medium
Problem

In the sample problem, for a given number n. the goal is to compute the probability that randomly chosen integer from a range [1,n] with uniform distribution is divisible by at least one of integers 2,3,11 or 13.

Constraints:

1n1018

Input format:

In the first and only line of the input there is one integer n.

Output format:

In a single line, output two space separated integers p and q, such that the probability o choosing an integer from a range [1,n] which is divisible by either 2,3,11 or 13 is equal to pq and p and q don't have common divisors greater than 1.

Sample Input
20
Sample Output
3 4
Time Limit: 5
Memory Limit: 256
Source Limit:
Explanation

There are 15 integers in a range [1,20] divisible by at least one of integers 2,3,11 or 13, thus the probability of randomly choosing such an integer is equal to 1520 which is equal to 34 after a simplification.

Editor Image

?