XHXMMMlOPIX0Wg#"'`%

该比赛已结束,您无法在比赛模式下递交该题目。您可以点击“在题库中打开”以普通模式查看和递交本题。

Statement

Dora has a set s s containing integers. In the beginning, she will put all integers in [l,r] [l, r] into the set s s . That is, an integer x x is initially contained in the set if and only if lxr l \leq x \leq r . Then she allows you to perform the following operations:

  • Select three distinct integers a a , b b , and c c from the set s s , such that gcd(a,b)=gcd(b,c)=gcd(a,c)=1 \gcd(a, b) = \gcd(b, c) = \gcd(a, c) = 1^\dagger .
  • Then, remove these three integers from the set s s .

What is the maximum number of operations you can perform?

^\dagger Recall that gcd(x,y) \gcd(x, y) means the greatest common divisor of integers x x and y y .

Format

Input

Each test consists of multiple test cases. The first line contains a single integer t t ( 1t500 1 \leq t \leq 500 ) — the number of test cases. The description of the test cases follows.

The only line of each test case contains two integers l l and r r ( 1lr1000 1 \leq l \leq r \leq 1000 ) — the range of integers in the initial set.

Output

For each test case, output a single integer — the maximum number of operations you can perform.

Sample

8
1 3
3 7
10 21
2 8
51 60
2 15
10 26
1 1000
1
1
3
1
2
3
4
250

ShanghaiTech ACM 炸鱼杯

未参加
状态
已结束
规则
OI
题目
46
开始于
2024-12-10 23:00
结束于
2024-12-15 13:00
持续时间
110 小时
主持人
参赛人数
112