#K69877. Minimum Fruit Order

    ID: 33184 Type: Default 1000ms 256MiB

Minimum Fruit Order

Minimum Fruit Order

Rachel is planning to restock her fruit inventory. She currently has a certain number of apples and bananas, and she wants to meet (or exceed) specific target numbers for both fruits. For each test case, you are given four integers:

  • CA: current number of apples
  • CB: current number of bananas
  • TA: target number of apples
  • TB: target number of bananas

Your task is to compute the minimum additional fruits Rachel needs to order so that both targets are met. In mathematical form, if we let:

$$required\_apples = \max(0, TA - CA)$$

$$required\_bananas = \max(0, TB - CB)$$

Then the answer for each test case is:

$$answer = required\_apples + required\_bananas$$

Print one result per test case.

inputFormat

The first line of input contains an integer T (the number of test cases). Each of the following T lines contains four space-separated integers: CA, CB, TA, TB representing the current number of apples, current number of bananas, target apples, and target bananas respectively.

outputFormat

For each test case, output a single line containing the minimum number of fruits Rachel needs to order.

## sample
1
30 40 50 60
40

</p>