P8313 [CF2060A] Fibonacciness
入门
题目描述

There is an array of $5$ integers. Initially, you only know $a_1,a_2,a_4,a_5$. You may set $a_3$ to any positive integer, negative integer, or zero. The Fibonacciness of the array is the number of integers $i$ ($1 \leq i \leq 3$) such that $a_{i+2}=a_i+a_{i+1}$. Find the maximum Fibonacciness over all integer values of $a_3$.

Input

The first line contains an integer $t$ ($1 \leq t \leq 500$) — the number of test cases.

The only line of each test case contains four integers $a_1, a_2, a_4, a_5$ ($1 \leq a_i \leq 100$).

Output

For each test case, output the maximum Fibonacciness on a new line.

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
6 1 1 3 5 1 3 2 1 8 10 28 100 100 1 100 1 1 100 1 100 100 100 100 100
样例输出
3 2 2 1 1 2
提示

In the first test case, we can set $a_3$ to $2$ to achieve the maximal Fibonacciness of $3$.

In the third test case, it can be shown that $2$ is the maximum Fibonacciness that can be achieved. This can be done by setting $a_3$ to $18$.