Segments#7287

Segments

2 seconds
64 megabytes
Medium

RuNU is celebrating University Day, and the brightest students from Ruthenia are invited to join the festivities. Stepan wants to be on the guest list, but to do so, he must solve a challenging problem. This day is special, and the problem is both complex and unique. However, Stepan is not discouraged because he knows he can rely on your help. Can you assist Stepan and ensure he makes it to the celebration? Let's see!

The problem involves segments, each defined by two numbers: and , representing the left and right boundaries of the segment, respectively. Your task is to determine how many numbers are divisible by and fall within at least one of these segments.

Input

The first line contains a single integer (1 \leq N \leq 10^{5}). The next lines each contain two integers and (1 \leq L \leq R \leq 10^{18}).

Output

Output a single number, which is the solution to the problem.

Examples

Example 1

Loading
Loading