Celex Update

medium
<a href="https://codeforces.com/problemset/problem/1358/C" target="_blank"><i class="fa fa-external-link" aria-hidden="true"> Link -> Celex Update</i></a>

Input Format

check the link

Output Format

check the link

Constraints

check the link

Notice

check the link

Example

Input
4
1 1 2 2
1 2 2 4
179 1 179 100000
5 7 5 7
Output
2
3
1
1
Previous
Square-free Division (easy Version)
Next
Hilbert's Hotel

Related Questions