Chef has two piles of stones with him, one has n1 stones and the other has n2 stones. Fired up by boredom, he invented a game with the two piles.

Before the start of the game Chef chooses an integer m.

In the j-th move: 

-  He chooses a number xj such that 1 ≤ xj ≤ m, and removes xj stones from both the piles (this is only possible when both the piles have ≥ xj stones).
-  The number chosen must be unique over all the moves in the game. That is, for all k < j, xj ≠ xk. 

The game stops when Chef is unable to make any more moves.

Chef wants to make the moves in such a way that the sum of the number of stones remaining in the two piles is minimized. Please help Chef find this.

-----Input-----
- The first line of input contains an integer T denoting the number of test cases.
- Each test case consists of 1 line with three integers — n1, n2 and m — separated by single spaces.

-----Output-----
For each test case, output a single line containing the minimum sum of the number of stones of two piles.

-----Constraints-----
Subtask 1 : (5 pts)
- 1 ≤ T ≤ 100
- 0 ≤ m ≤ 18
- 0 ≤ n1, n2 ≤ 100
Subtask 2 : (25 pts)
- 1 ≤ T ≤ 1000
- 0 ≤ m ≤ 10000
- 0 ≤ n1, n2 ≤ 10000
Subtask 3 : (70 pts)
- 1 ≤ T ≤ 105
- 0 ≤ m ≤ 109
- 0 ≤ n1, n2 ≤ 1018

-----Example-----
Input:3
1 1 1
1 2 1
4 5 2

Output:0
1
3

-----Explanation-----
Example case 1. : Remove 1 stone from each of the piles. Now 0 stones are remaining, so chef cannot remove any more stones from the piles. Hence, answer is 0+0 = 0
Example case 2. : Again, remove 1 stone from both the piles to get (0,1) stones. Now chef cannot remove any more stones from pile 1, so he stops. Hence, answer is 0+1 = 1.
Example case 3. : First remove 1 stone from both the piles to get (3,4) stones. Now, remove 2 stones from both the piles so that (1,2) stones are remaining. Now chef cannot remove any more stones owing to the condition that he cannot remove the same number of stones twice. So, the answer is 1+2 = 3.

```python

USER_FILENAME = "<user_code>"
import sys, json, builtins
import math, heapq, bisect, itertools, functools, collections, statistics, fractions, decimal, operator, array, random, re, string, os, pathlib
try:
    import resource as _res
except Exception:
    _res = None
from collections import Counter, defaultdict, deque, OrderedDict
from functools import lru_cache, reduce
from itertools import accumulate, permutations, combinations, product
from math import gcd, ceil, floor, sqrt
from decimal import Decimal
try:
    from typing import *
except Exception:
    pass
try:
    sys.setrecursionlimit(1_000_000)
except Exception:
    pass
try:
    import site as _site
    try:
        _sys_sites = _site.getsitepackages() if hasattr(_site, "getsitepackages") else []
        for _p in _sys_sites:
            if _p and _p not in sys.path:
                sys.path.append(_p)
    except Exception:
        pass
    try:
        _usp = _site.getusersitepackages()
        if isinstance(_usp, str):
            _usp = [_usp]
        for _p in _usp:
            if _p and _p not in sys.path:
                sys.path.append(_p)
    except Exception:
        pass
except Exception:
    pass

ns = {"__name__": "__main__"}
for _k, _v in list(globals().items()):
    if not _k.startswith("_"):
        ns[_k] = _v
_CODE = 'def find_min(m,W):\n i=1\n while i <= m :\n  if i not in W:\n   break\n  i+=1\n return i\n \ndef find_max(M,W,m):\n i=min(M,m)\n while i > 0 :\n  if i not in W:\n   break\n  i-=1\n return i\n \ndef knap(M,W,m):\n if len(W)==m or M < find_min(m,W) or M==0 :\n  return 0\n if m*(m+1)/2<M:\n  return m*(m+1)/2\n #if (M,W,m) in cache:\n #    return cache[(M,W,m)] \n val = find_max(M,W,m)\n W.add(val)\n #if val == M:\n #    return val\n #print val,M\n #cache[(M,W,m)] = \n return val+knap(M-val,W,m)\n #return cache[(M,W,m)] \n \ntests = int(input())\nfor i in range(tests):\n n1,n2,m = ([int(x) for x in input().split(" ")])\n W = set()\n M = min(n1,n2)\n print(max(n1,n2)-M + 2*(M-knap(M,W,m))) '
_co = compile(_CODE, USER_FILENAME, "exec")
exec(_co, ns, ns)

```

Measured memory_bytes: 13521