#!/bin/python3 import sys def profit(a, b, c): val1 = b - a p = (c + val1) - 2*b return abs(p) if __name__ == "__main__": t = int(input().strip()) for a0 in range(t): a, b, c = input().strip().split(' ') a, b, c = [int(a), int(b), int(c)] result = profit(a, b, c) print(result)