Circle Of Monsters

easy
<a href="https://codeforces.com/problemset/problem/1334/C" target="_blank"><i class="fa fa-external-link" aria-hidden="true"> Link -> Circle of Monsters</i></a>

Input Format

check the link

Output Format

check the link

Constraints

check the link

Example

Input
1
3
7 15
2 14
5 3
Output
6
Previous
Orac And Lcm
Next
Yet Another Counting Problem

Related Questions