import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;

public class Main {

    public static void main(final String[] args) throws IOException {
        final BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        int t = Integer.parseInt(reader.readLine().trim());
        while (t-- > 0) {
            int[] arr = new int[3];
            String[] s = reader.readLine().trim().split(" ");
            for (int i = 0; i < 3; i++) {
                arr[i] = Integer.parseInt(s[i]);
            }
            Arrays.sort(arr);
            long d = arr[0] + arr[1] - 1;
            System.out.println(d+arr[2]-1);
        }
        reader.close();
    }
}


import java.io.*;
import java.util.*;

public class Main{

	static int mod=(int)1e9+7;

	public static void main(String[] args) throws IOException {
		Writer out=new Writer(System.out);
		Reader in=new Reader(System.in);
		int ts=in.nextInt();
//		int ts=1;
		outer: while(ts-->0) {

			int a[]=in.readArray(3);
			int sum=0;
			for(int i:a ) sum+=i;
			out.println(sum-1);

		}
		out.close();

	}

/*********************************** UTILITY CODE BELOW **************************************/

	static int abs(int a) {
		return a>0 ? a : -a;
	}

	static int max(int a, int b) {
		return a>b ? a : b;
	}

	static long pow(long n, long m) {
		if(m==0) return 1;
		long temp=pow(n,m/2);
		long res=((temp*temp)%mod);
		if(m%2==0) return res;
		return (res*n)%mod;
	}

	static class Pair{
		int u, v;

		Pair(int u, int v){this.u=u; this.v=v;}

		static void sort(Pair [] coll) {
			List<Pair> al=new ArrayList<>(Arrays.asList(coll));
			Collections.sort(al,new Comparator<Pair>() {
				public int compare(Pair p1, Pair p2) {
					return p1.u-p2.u;
				}
			});
			for(int i=0; i<al.size(); i++) {
				coll[i]=al.get(i);
			}
		}

	}

	static void sort(int[] a) {
		ArrayList<Integer> list=new ArrayList<>();
		for (int i:a) list.add(i);
		Collections.sort(list);
		for (int i=0; i<a.length; i++) a[i]=list.get(i);
	}

	static void sort(long a[]) {
		ArrayList<Long> list=new ArrayList<>();
		for(long i: a) list.add(i);
		Collections.sort(list);
		for(int i=0; i<a.length; i++) a[i]=list.get(i);
	}

	static int [] array(int n, int value) {
		int a[]=new int[n];
		for(int i=0; i<n; i++) a[i]=value;
		return a;
	}

	static class Reader{

		BufferedReader br;
		StringTokenizer to;

		Reader(InputStream stream){
			br=new BufferedReader(new InputStreamReader(stream));
			to=new StringTokenizer("");
		}

		String next() {
			while(!to.hasMoreTokens()) {
				try {
					to=new StringTokenizer(br.readLine());
				}catch(IOException e) {}

			}
			return to.nextToken();

		}

		int nextInt() {
			return Integer.parseInt(next());
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		int [] readArray(int n) {
			int a[]=new int[n];
			for(int i=0; i<n ;i++) a[i]=nextInt();
			return a;
		}
		long [] readLongArray(int n) {
			long a[]=new long[n];
			for(int i=0; i<n ;i++) a[i]=nextLong();
			return a;
		}

	}

	static class Writer extends PrintWriter{
		Writer(OutputStream stream){
			super(stream);
		}
		void println(int [] array) {
			for(int i=0; i<array.length; i++) {
				print(array[i]+" ");
			}
			println();
		}
		void println(long [] array) {
			for(int i=0; i<array.length; i++) {
				print(array[i]+" ");
			}
			println();
		}
	}

}


import java.io.*;
import java.util.*;

public class Main{

	static int mod=(int)1e9+7;

	public static void main(String[] args) throws IOException {
		Writer out=new Writer(System.out);
		Reader in=new Reader(System.in);
		int ts=in.nextInt();
//		int ts=1;
		outer: while(ts-->0) {

			int a[]=in.readArray(3);
			sort(a);
			out.println(a[2]+1);

		}
		out.close();

	}

	static long sum(String s) {
		if(s.length()==1) return Integer.parseInt(s);

		long curr=Integer.parseInt(s.substring(s.length()-1,s.length()));

		return sum(s.substring(0,s.length()-1))*10+curr*(pow(2,s.length())-1)%mod;
	}

	static int modulo(String s) {
		char [] ch=s.toCharArray();
		long ans=0;
		for(char c: ch) {
			ans=(long)(ans*10)+(c-'0');
			ans=ans%mod;
		}
		return (int)ans;
	}

/*********************************** UTILITY CODE BELOW **************************************/

	static int abs(int a) {
		return a>0 ? a : -a;
	}

	static int max(int a, int b) {
		return a>b ? a : b;
	}

	static long pow(long n, long m) {
		if(m==0) return 1;
		long temp=pow(n,m/2);
		long res=((temp*temp)%mod);
		if(m%2==0) return res;
		return (res*n)%mod;
	}

	static class Pair{
		int u, v;

		Pair(int u, int v){this.u=u; this.v=v;}

		static void sort(Pair [] coll) {
			List<Pair> al=new ArrayList<>(Arrays.asList(coll));
			Collections.sort(al,new Comparator<Pair>() {
				public int compare(Pair p1, Pair p2) {
					return p1.u-p2.u;
				}
			});
			for(int i=0; i<al.size(); i++) {
				coll[i]=al.get(i);
			}
		}

	}

	static void sort(int[] a) {
		ArrayList<Integer> list=new ArrayList<>();
		for (int i:a) list.add(i);
		Collections.sort(list);
		for (int i=0; i<a.length; i++) a[i]=list.get(i);
	}

	static void sort(long a[]) {
		ArrayList<Long> list=new ArrayList<>();
		for(long i: a) list.add(i);
		Collections.sort(list);
		for(int i=0; i<a.length; i++) a[i]=list.get(i);
	}

	static int [] array(int n, int value) {
		int a[]=new int[n];
		for(int i=0; i<n; i++) a[i]=value;
		return a;
	}

	static class Reader{

		BufferedReader br;
		StringTokenizer to;

		Reader(InputStream stream){
			br=new BufferedReader(new InputStreamReader(stream));
			to=new StringTokenizer("");
		}

		String next() {
			while(!to.hasMoreTokens()) {
				try {
					to=new StringTokenizer(br.readLine());
				}catch(IOException e) {}

			}
			return to.nextToken();

		}

		int nextInt() {
			return Integer.parseInt(next());
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		int [] readArray(int n) {
			int a[]=new int[n];
			for(int i=0; i<n ;i++) a[i]=nextInt();
			return a;
		}
		long [] readLongArray(int n) {
			long a[]=new long[n];
			for(int i=0; i<n ;i++) a[i]=nextLong();
			return a;
		}

	}

	static class Writer extends PrintWriter{
		Writer(OutputStream stream){
			super(stream);
		}
		void println(int [] array) {
			for(int i=0; i<array.length; i++) {
				print(array[i]+" ");
			}
			println();
		}
		void println(long [] array) {
			for(int i=0; i<array.length; i++) {
				print(array[i]+" ");
			}
			println();
		}
	}

}


import java.io.*;
import java.util.*;

public class Main{

	static int mod=(int)1e9+7;

	public static void main(String[] args) throws IOException {
		Writer out=new Writer(System.out);
		Reader in=new Reader(System.in);
		int ts=in.nextInt();
//		int ts=1;
		outer: while(ts-->0) {

			int a[]=in.readArray(3);
			out.println(1);

		}
		out.close();

	}

/*********************************** UTILITY CODE BELOW **************************************/

	static int abs(int a) {
		return a>0 ? a : -a;
	}

	static int max(int a, int b) {
		return a>b ? a : b;
	}

	static long pow(long n, long m) {
		if(m==0) return 1;
		long temp=pow(n,m/2);
		long res=((temp*temp)%mod);
		if(m%2==0) return res;
		return (res*n)%mod;
	}

	static class Pair{
		int u, v;

		Pair(int u, int v){this.u=u; this.v=v;}

		static void sort(Pair [] coll) {
			List<Pair> al=new ArrayList<>(Arrays.asList(coll));
			Collections.sort(al,new Comparator<Pair>() {
				public int compare(Pair p1, Pair p2) {
					return p1.u-p2.u;
				}
			});
			for(int i=0; i<al.size(); i++) {
				coll[i]=al.get(i);
			}
		}

	}

	static void sort(int[] a) {
		ArrayList<Integer> list=new ArrayList<>();
		for (int i:a) list.add(i);
		Collections.sort(list);
		for (int i=0; i<a.length; i++) a[i]=list.get(i);
	}

	static void sort(long a[]) {
		ArrayList<Long> list=new ArrayList<>();
		for(long i: a) list.add(i);
		Collections.sort(list);
		for(int i=0; i<a.length; i++) a[i]=list.get(i);
	}

	static int [] array(int n, int value) {
		int a[]=new int[n];
		for(int i=0; i<n; i++) a[i]=value;
		return a;
	}

	static class Reader{

		BufferedReader br;
		StringTokenizer to;

		Reader(InputStream stream){
			br=new BufferedReader(new InputStreamReader(stream));
			to=new StringTokenizer("");
		}

		String next() {
			while(!to.hasMoreTokens()) {
				try {
					to=new StringTokenizer(br.readLine());
				}catch(IOException e) {}

			}
			return to.nextToken();

		}

		int nextInt() {
			return Integer.parseInt(next());
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		int [] readArray(int n) {
			int a[]=new int[n];
			for(int i=0; i<n ;i++) a[i]=nextInt();
			return a;
		}
		long [] readLongArray(int n) {
			long a[]=new long[n];
			for(int i=0; i<n ;i++) a[i]=nextLong();
			return a;
		}

	}

	static class Writer extends PrintWriter{
		Writer(OutputStream stream){
			super(stream);
		}
		void println(int [] array) {
			for(int i=0; i<array.length; i++) {
				print(array[i]+" ");
			}
			println();
		}
		void println(long [] array) {
			for(int i=0; i<array.length; i++) {
				print(array[i]+" ");
			}
			println();
		}
	}

}


import java.io.*;
import java.util.*;

public class Main{

	static int mod=(int)1e9+7;

	public static void main(String[] args) throws IOException {
		Writer out=new Writer(System.out);
		Reader in=new Reader(System.in);
		int ts=in.nextInt();
//		int ts=1;
		outer: while(ts-->0) {

			int a[]=in.readArray(3);
			out.println(a[0]+1);

		}
		out.close();

	}

/*********************************** UTILITY CODE BELOW **************************************/

	static int abs(int a) {
		return a>0 ? a : -a;
	}

	static int max(int a, int b) {
		return a>b ? a : b;
	}

	static long pow(long n, long m) {
		if(m==0) return 1;
		long temp=pow(n,m/2);
		long res=((temp*temp)%mod);
		if(m%2==0) return res;
		return (res*n)%mod;
	}

	static class Pair{
		int u, v;

		Pair(int u, int v){this.u=u; this.v=v;}

		static void sort(Pair [] coll) {
			List<Pair> al=new ArrayList<>(Arrays.asList(coll));
			Collections.sort(al,new Comparator<Pair>() {
				public int compare(Pair p1, Pair p2) {
					return p1.u-p2.u;
				}
			});
			for(int i=0; i<al.size(); i++) {
				coll[i]=al.get(i);
			}
		}

	}

	static void sort(int[] a) {
		ArrayList<Integer> list=new ArrayList<>();
		for (int i:a) list.add(i);
		Collections.sort(list);
		for (int i=0; i<a.length; i++) a[i]=list.get(i);
	}

	static void sort(long a[]) {
		ArrayList<Long> list=new ArrayList<>();
		for(long i: a) list.add(i);
		Collections.sort(list);
		for(int i=0; i<a.length; i++) a[i]=list.get(i);
	}

	static int [] array(int n, int value) {
		int a[]=new int[n];
		for(int i=0; i<n; i++) a[i]=value;
		return a;
	}

	static class Reader{

		BufferedReader br;
		StringTokenizer to;

		Reader(InputStream stream){
			br=new BufferedReader(new InputStreamReader(stream));
			to=new StringTokenizer("");
		}

		String next() {
			while(!to.hasMoreTokens()) {
				try {
					to=new StringTokenizer(br.readLine());
				}catch(IOException e) {}

			}
			return to.nextToken();

		}

		int nextInt() {
			return Integer.parseInt(next());
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		int [] readArray(int n) {
			int a[]=new int[n];
			for(int i=0; i<n ;i++) a[i]=nextInt();
			return a;
		}
		long [] readLongArray(int n) {
			long a[]=new long[n];
			for(int i=0; i<n ;i++) a[i]=nextLong();
			return a;
		}

	}

	static class Writer extends PrintWriter{
		Writer(OutputStream stream){
			super(stream);
		}
		void println(int [] array) {
			for(int i=0; i<array.length; i++) {
				print(array[i]+" ");
			}
			println();
		}
		void println(long [] array) {
			for(int i=0; i<array.length; i++) {
				print(array[i]+" ");
			}
			println();
		}
	}

}


import java.util.*;
import java.io.*;

public class A{
	public static void main(String[] args)  throws IOException,NumberFormatException{
		try {
		FastScanner sc=new FastScanner();
		int t=sc.nextInt();
		while(t-->0) {
			int a=sc.nextInt(),b=sc.nextInt(),c=sc.nextInt();
			int base=Math.abs(a-c);
			System.out.println((long)(Math.sqrt((long)(base*base)+(long)(b*b))));

		}
		}
		catch(Exception e) {
			return ;
		}

	}
	static final Random random=new Random();

	static void ruffleSort(int[] a) {
		int n=a.length;
		for(int i=0;i<n;i++) {
			int oi=random.nextInt(n),temp=a[oi];
			a[oi]=a[i]; a[i]=temp;
		}
		Arrays.sort(a);
	}

	public static class FastScanner {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st=new StringTokenizer("");
		String next() {
			while (!st.hasMoreTokens())
				try {
                                      st=new StringTokenizer(br.readLine());
                              } catch (IOException e) {}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		int[] readArray(int n) {
			int[] a=new int[n];
			for (int i=0; i<n; i++) a[i]=nextInt();
			return a;
		}

		long[] readLongArray(int n) {
			long[] a=new long[n];
			for(int i=0; i<n ; i++) a[i]=nextLong();
			return a;
		}

		String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
	}

}


import java.util.*;
import java.io.*;

public class A{
	public static void main(String[] args)  throws IOException,NumberFormatException{
		try {
		FastScanner sc=new FastScanner();
		int t=sc.nextInt();
		while(t-->0) {
			int a=sc.nextInt(),b=sc.nextInt(),c=sc.nextInt();
			int base=Math.abs(a-c);
			System.out.println((long)Math.ceil(Math.sqrt((long)(base*base)+(long)(b*b))));

		}
		}
		catch(Exception e) {
			return ;
		}

	}
	static final Random random=new Random();

	static void ruffleSort(int[] a) {
		int n=a.length;
		for(int i=0;i<n;i++) {
			int oi=random.nextInt(n),temp=a[oi];
			a[oi]=a[i]; a[i]=temp;
		}
		Arrays.sort(a);
	}

	public static class FastScanner {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st=new StringTokenizer("");
		String next() {
			while (!st.hasMoreTokens())
				try {
                                      st=new StringTokenizer(br.readLine());
                              } catch (IOException e) {}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		int[] readArray(int n) {
			int[] a=new int[n];
			for (int i=0; i<n; i++) a[i]=nextInt();
			return a;
		}

		long[] readLongArray(int n) {
			long[] a=new long[n];
			for(int i=0; i<n ; i++) a[i]=nextLong();
			return a;
		}

		String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
	}

}


import java.util.*;
import java.io.*;

public class A{
	public static void main(String[] args)  throws IOException,NumberFormatException{
		try {
		FastScanner sc=new FastScanner();
		int t=sc.nextInt();
		while(t-->0) {
			int a=sc.nextInt(),b=sc.nextInt(),c=sc.nextInt();
			System.out.println(a+(long)b+c-1);

		}
		}
		catch(Exception e) {
			return ;
		}

	}
	static final Random random=new Random();

	static void ruffleSort(int[] a) {
		int n=a.length;
		for(int i=0;i<n;i++) {
			int oi=random.nextInt(n),temp=a[oi];
			a[oi]=a[i]; a[i]=temp;
		}
		Arrays.sort(a);
	}

	public static class FastScanner {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st=new StringTokenizer("");
		String next() {
			while (!st.hasMoreTokens())
				try {
                                      st=new StringTokenizer(br.readLine());
                              } catch (IOException e) {}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		int[] readArray(int n) {
			int[] a=new int[n];
			for (int i=0; i<n; i++) a[i]=nextInt();
			return a;
		}

		long[] readLongArray(int n) {
			long[] a=new long[n];
			for(int i=0; i<n ; i++) a[i]=nextLong();
			return a;
		}

		String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
	}

}


import java.util.Scanner;

public class _0169Fence {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int cases=sc.nextInt();
		while(cases>0) {
		long n=sc.nextInt();
		long k=sc.nextInt();
		long c=sc.nextInt();
		System.out.println(n+k+c-1);
		cases--;
		}
	}

}


import java.util.Scanner;

public class _0169Fence {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int cases=sc.nextInt();
		while(cases>0) {
		int n=sc.nextInt();
		int k=sc.nextInt();
		int c=sc.nextInt();
		System.out.println(n+k+c-1);
		cases--;
		}
	}

}


import java.util.Scanner;

public class _0169Fence {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int n=sc.nextInt();
		int k=sc.nextInt();
		int c=sc.nextInt();
		System.out.println(n+k+c-1);
	}

}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;
public class Fence {
    public static void main(String[] args) throws IOException{
        BufferedReader r=new BufferedReader(new InputStreamReader(System.in));
        int t=Integer.parseInt(r.readLine());
        while(t-->0){
            StringTokenizer t1=new StringTokenizer(r.readLine());
            int[]array=new int[3];
            for(int i=0;i<3;i++)
                array[i]=Integer.parseInt(t1.nextToken());
            Arrays.sort(array);
            int n=array[2]-array[1]-array[0];
            System.out.println(Math.max(n, array[n]+1));
        }
    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Fence {
    public static void main(String[] args) throws IOException{
        BufferedReader r=new BufferedReader(new InputStreamReader(System.in));
        int t=Integer.parseInt(r.readLine());
        while(t-->0){
            r.readLine();
            System.out.println(1);
        }
    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;
public class Fence {
    public static void main(String[] args) throws IOException{
        BufferedReader r=new BufferedReader(new InputStreamReader(System.in));
        int t=Integer.parseInt(r.readLine());
        while(t-->0){
            StringTokenizer t1=new StringTokenizer(r.readLine());
            int[]array=new int[3];
            for(int i=0;i<3;i++)
                array[i]=Integer.parseInt(t1.nextToken());
            Arrays.sort(array);
            int n=array[2]-array[1]-array[0];
            System.out.println(Math.max(n, array[2]+1));
        }
    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;
public class Fence {
    public static void main(String[] args) throws IOException{
        BufferedReader r=new BufferedReader(new InputStreamReader(System.in));
        int t=Integer.parseInt(r.readLine());
        while(t-->0){
            StringTokenizer t1=new StringTokenizer(r.readLine());
            int[]array=new int[3];
            for(int i=0;i<3;i++)
                array[i]=Integer.parseInt(t1.nextToken());
            Arrays.sort(array);
            int n=array[2]-array[1]-array[0];
            System.out.println(Math.max(n, 1));
        }
    }
}


import java.io.*;
import java.nio.charset.Charset;
import java.util.*;
//@Author Why_Do_You_Want_To_Know_My_Name?

public class Main {
    public static void main(String[] args) {
        Charset charset = Charset.forName("ascii");
        FastIO sc = new FastIO(System.in, System.out, charset);
        int t=sc.readInt();
        for (int i = 0; i < t; i++) {
            long a=sc.readLong();
            long b=sc.readLong();
            long c=sc.readLong();
            System.out.println(a+b+c-2l);
        }
    }
}
class FastIO {
    public final StringBuilder cache = new StringBuilder(1 << 20);
    private final InputStream is;
    private final OutputStream os;
    private final Charset charset;
    private StringBuilder defaultStringBuf = new StringBuilder(1 << 8);
    private byte[] buf = new byte[1 << 13];
    private int bufLen;
    private int bufOffset;
    private int next;

    public FastIO(InputStream is, OutputStream os, Charset charset) {
        this.is = is;
        this.os = os;
        this.charset = charset;
    }

    public FastIO(InputStream is, OutputStream os) {
        this(is, os, Charset.forName("ascii"));
    }

    private int read() {
        while (bufLen == bufOffset) {
            bufOffset = 0;
            try {
                bufLen = is.read(buf);
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
            if (bufLen == -1) {
                return -1;
            }
        }
        return buf[bufOffset++];
    }

    public void skipBlank() {
        while (next >= 0 && next <= 32) {
            next = read();
        }
    }

    public int readInt() {
        int sign = 1;

        skipBlank();
        if (next == '+' || next == '-') {
            sign = next == '+' ? 1 : -1;
            next = read();
        }

        int val = 0;
        if (sign == 1) {
            while (next >= '0' && next <= '9') {
                val = val * 10 + next - '0';
                next = read();
            }
        } else {
            while (next >= '0' && next <= '9') {
                val = val * 10 - next + '0';
                next = read();
            }
        }

        return val;
    }

    public long readLong() {
        int sign = 1;

        skipBlank();
        if (next == '+' || next == '-') {
            sign = next == '+' ? 1 : -1;
            next = read();
        }

        long val = 0;
        if (sign == 1) {
            while (next >= '0' && next <= '9') {
                val = val * 10 + next - '0';
                next = read();
            }
        } else {
            while (next >= '0' && next <= '9') {
                val = val * 10 - next + '0';
                next = read();
            }
        }

        return val;
    }

    public double readDouble() {
        boolean sign = true;
        skipBlank();
        if (next == '+' || next == '-') {
            sign = next == '+';
            next = read();
        }

        long val = 0;
        while (next >= '0' && next <= '9') {
            val = val * 10 + next - '0';
            next = read();
        }
        if (next != '.') {
            return sign ? val : -val;
        }
        next = read();
        long radix = 1;
        long point = 0;
        while (next >= '0' && next <= '9') {
            point = point * 10 + next - '0';
            radix = radix * 10;
            next = read();
        }
        double result = val + (double) point / radix;
        return sign ? result : -result;
    }

    public String readString(StringBuilder builder) {
        skipBlank();

        while (next > 32) {
            builder.append((char) next);
            next = read();
        }

        return builder.toString();
    }

    public String readString() {
        defaultStringBuf.setLength(0);
        return readString(defaultStringBuf);
    }

    public int readLine(char[] data, int offset) {
        int originalOffset = offset;
        while (next != -1 && next != '\n') {
            data[offset++] = (char) next;
            next = read();
        }
        return offset - originalOffset;
    }

    public int readString(char[] data, int offset) {
        skipBlank();

        int originalOffset = offset;
        while (next > 32) {
            data[offset++] = (char) next;
            next = read();
        }

        return offset - originalOffset;
    }

    public int readString(byte[] data, int offset) {
        skipBlank();

        int originalOffset = offset;
        while (next > 32) {
            data[offset++] = (byte) next;
            next = read();
        }

        return offset - originalOffset;
    }

    public char readChar() {
        skipBlank();
        char c = (char) next;
        next = read();
        return c;
    }

    public void flush() {
        try {
            os.write(cache.toString().getBytes(charset));
            os.flush();
            cache.setLength(0);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }

    public boolean hasMore() {
        skipBlank();
        return next != -1;
    }
}


package Fence;
import java.io.*;
import java.nio.charset.Charset;
import java.util.*;
//@Author Why_Do_You_Want_To_Know_My_Name?

public class Main {
    public static void main(String[] args) {
        Charset charset = Charset.forName("ascii");
        FastIO sc = new FastIO(System.in, System.out, charset);
        int t=sc.readInt();
        for (int i = 0; i < t; i++) {
            long a=sc.readLong();
            long b=sc.readLong();
            long c=sc.readLong();
            long ans=a+b+c-2l;
            System.out.println(ans);
        }
    }
}
class FastIO {
    public final StringBuilder cache = new StringBuilder(1 << 20);
    private final InputStream is;
    private final OutputStream os;
    private final Charset charset;
    private StringBuilder defaultStringBuf = new StringBuilder(1 << 8);
    private byte[] buf = new byte[1 << 13];
    private int bufLen;
    private int bufOffset;
    private int next;

    public FastIO(InputStream is, OutputStream os, Charset charset) {
        this.is = is;
        this.os = os;
        this.charset = charset;
    }

    public FastIO(InputStream is, OutputStream os) {
        this(is, os, Charset.forName("ascii"));
    }

    private int read() {
        while (bufLen == bufOffset) {
            bufOffset = 0;
            try {
                bufLen = is.read(buf);
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
            if (bufLen == -1) {
                return -1;
            }
        }
        return buf[bufOffset++];
    }

    public void skipBlank() {
        while (next >= 0 && next <= 32) {
            next = read();
        }
    }

    public int readInt() {
        int sign = 1;

        skipBlank();
        if (next == '+' || next == '-') {
            sign = next == '+' ? 1 : -1;
            next = read();
        }

        int val = 0;
        if (sign == 1) {
            while (next >= '0' && next <= '9') {
                val = val * 10 + next - '0';
                next = read();
            }
        } else {
            while (next >= '0' && next <= '9') {
                val = val * 10 - next + '0';
                next = read();
            }
        }

        return val;
    }

    public long readLong() {
        int sign = 1;

        skipBlank();
        if (next == '+' || next == '-') {
            sign = next == '+' ? 1 : -1;
            next = read();
        }

        long val = 0;
        if (sign == 1) {
            while (next >= '0' && next <= '9') {
                val = val * 10 + next - '0';
                next = read();
            }
        } else {
            while (next >= '0' && next <= '9') {
                val = val * 10 - next + '0';
                next = read();
            }
        }

        return val;
    }

    public double readDouble() {
        boolean sign = true;
        skipBlank();
        if (next == '+' || next == '-') {
            sign = next == '+';
            next = read();
        }

        long val = 0;
        while (next >= '0' && next <= '9') {
            val = val * 10 + next - '0';
            next = read();
        }
        if (next != '.') {
            return sign ? val : -val;
        }
        next = read();
        long radix = 1;
        long point = 0;
        while (next >= '0' && next <= '9') {
            point = point * 10 + next - '0';
            radix = radix * 10;
            next = read();
        }
        double result = val + (double) point / radix;
        return sign ? result : -result;
    }

    public String readString(StringBuilder builder) {
        skipBlank();

        while (next > 32) {
            builder.append((char) next);
            next = read();
        }

        return builder.toString();
    }

    public String readString() {
        defaultStringBuf.setLength(0);
        return readString(defaultStringBuf);
    }

    public int readLine(char[] data, int offset) {
        int originalOffset = offset;
        while (next != -1 && next != '\n') {
            data[offset++] = (char) next;
            next = read();
        }
        return offset - originalOffset;
    }

    public int readString(char[] data, int offset) {
        skipBlank();

        int originalOffset = offset;
        while (next > 32) {
            data[offset++] = (char) next;
            next = read();
        }

        return offset - originalOffset;
    }

    public int readString(byte[] data, int offset) {
        skipBlank();

        int originalOffset = offset;
        while (next > 32) {
            data[offset++] = (byte) next;
            next = read();
        }

        return offset - originalOffset;
    }

    public char readChar() {
        skipBlank();
        char c = (char) next;
        next = read();
        return c;
    }

    public void flush() {
        try {
            os.write(cache.toString().getBytes(charset));
            os.flush();
            cache.setLength(0);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }

    public boolean hasMore() {
        skipBlank();
        return next != -1;
    }
}


package Fence;
import java.io.*;
import java.nio.charset.Charset;
import java.util.*;
//@Author Why_Do_You_Want_To_Know_My_Name?

public class Main {
    public static void main(String[] args) {
        Charset charset = Charset.forName("ascii");
        FastIO sc = new FastIO(System.in, System.out, charset);
        int t=sc.readInt();
        for (int i = 0; i < t; i++) {
            long a=sc.readLong();
            long b=sc.readLong();
            long c=sc.readLong();
            System.out.println(a+b+c-2l);
        }
    }
}
class FastIO {
    public final StringBuilder cache = new StringBuilder(1 << 20);
    private final InputStream is;
    private final OutputStream os;
    private final Charset charset;
    private StringBuilder defaultStringBuf = new StringBuilder(1 << 8);
    private byte[] buf = new byte[1 << 13];
    private int bufLen;
    private int bufOffset;
    private int next;

    public FastIO(InputStream is, OutputStream os, Charset charset) {
        this.is = is;
        this.os = os;
        this.charset = charset;
    }

    public FastIO(InputStream is, OutputStream os) {
        this(is, os, Charset.forName("ascii"));
    }

    private int read() {
        while (bufLen == bufOffset) {
            bufOffset = 0;
            try {
                bufLen = is.read(buf);
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
            if (bufLen == -1) {
                return -1;
            }
        }
        return buf[bufOffset++];
    }

    public void skipBlank() {
        while (next >= 0 && next <= 32) {
            next = read();
        }
    }

    public int readInt() {
        int sign = 1;

        skipBlank();
        if (next == '+' || next == '-') {
            sign = next == '+' ? 1 : -1;
            next = read();
        }

        int val = 0;
        if (sign == 1) {
            while (next >= '0' && next <= '9') {
                val = val * 10 + next - '0';
                next = read();
            }
        } else {
            while (next >= '0' && next <= '9') {
                val = val * 10 - next + '0';
                next = read();
            }
        }

        return val;
    }

    public long readLong() {
        int sign = 1;

        skipBlank();
        if (next == '+' || next == '-') {
            sign = next == '+' ? 1 : -1;
            next = read();
        }

        long val = 0;
        if (sign == 1) {
            while (next >= '0' && next <= '9') {
                val = val * 10 + next - '0';
                next = read();
            }
        } else {
            while (next >= '0' && next <= '9') {
                val = val * 10 - next + '0';
                next = read();
            }
        }

        return val;
    }

    public double readDouble() {
        boolean sign = true;
        skipBlank();
        if (next == '+' || next == '-') {
            sign = next == '+';
            next = read();
        }

        long val = 0;
        while (next >= '0' && next <= '9') {
            val = val * 10 + next - '0';
            next = read();
        }
        if (next != '.') {
            return sign ? val : -val;
        }
        next = read();
        long radix = 1;
        long point = 0;
        while (next >= '0' && next <= '9') {
            point = point * 10 + next - '0';
            radix = radix * 10;
            next = read();
        }
        double result = val + (double) point / radix;
        return sign ? result : -result;
    }

    public String readString(StringBuilder builder) {
        skipBlank();

        while (next > 32) {
            builder.append((char) next);
            next = read();
        }

        return builder.toString();
    }

    public String readString() {
        defaultStringBuf.setLength(0);
        return readString(defaultStringBuf);
    }

    public int readLine(char[] data, int offset) {
        int originalOffset = offset;
        while (next != -1 && next != '\n') {
            data[offset++] = (char) next;
            next = read();
        }
        return offset - originalOffset;
    }

    public int readString(char[] data, int offset) {
        skipBlank();

        int originalOffset = offset;
        while (next > 32) {
            data[offset++] = (char) next;
            next = read();
        }

        return offset - originalOffset;
    }

    public int readString(byte[] data, int offset) {
        skipBlank();

        int originalOffset = offset;
        while (next > 32) {
            data[offset++] = (byte) next;
            next = read();
        }

        return offset - originalOffset;
    }

    public char readChar() {
        skipBlank();
        char c = (char) next;
        next = read();
        return c;
    }

    public void flush() {
        try {
            os.write(cache.toString().getBytes(charset));
            os.flush();
            cache.setLength(0);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }

    public boolean hasMore() {
        skipBlank();
        return next != -1;
    }
}


import java.util.*;
public class S
{
    public static void main(String [] args)
    {
        Scanner obj = new Scanner(System.in);
        int t= obj.nextInt();
        while(t-->0)
        {
        	long  a = obj.nextInt();
        	long b = obj.nextInt();
        	long c =obj.nextInt();
        	//int arr [] ={a,b,c};
        	//Arrays.sort(arr);
        	long req=a+b+c-1;
        	System.out.println(req);
        }
    }
}


import java.util.*;
public class S
{
    public static void main(String [] args)
    {
        Scanner obj = new Scanner(System.in);
        int t= obj.nextInt();
        while(t-->0)
        {
        	int a = obj.nextInt();
        	int b = obj.nextInt();
        	int c =obj.nextInt();
        	int arr [] ={a,b,c};
        	Arrays.sort(arr);
        	int k=arr[2]-arr[1];
        	int m = arr[0];
        	double an=k*k+m*m;
        	int ans = (int)Math.ceil(Math.sqrt(an));
        	System.out.println(ans);
        }
    }
}


import java.util.*;
public class S
{
    public static void main(String [] args)
    {
        Scanner obj = new Scanner(System.in);
        int t= obj.nextInt();
        while(t-->0)
        {
        	int a = obj.nextInt();
        	int b = obj.nextInt();
        	int c =obj.nextInt();
        	int arr [] ={a,b,c};
        	Arrays.sort(arr);
        	int k=arr[2]-arr[1];
        	int m = arr[0];
        	double an=k*k+m*m;
        	double ans = (Math.sqrt(an));
        	System.out.println(ans);
        }
    }
}


import java.util.*;
public class S
{
    public static void main(String [] args)
    {
        Scanner obj = new Scanner(System.in);
        int t= obj.nextInt();
        while(t-->0)
        {
        	int a = obj.nextInt();
        	int b = obj.nextInt();
        	int c =obj.nextInt();
        	System.out.println(c+1);
        }
    }
}


import java.util.*;
public class S
{
    public static void main(String [] args)
    {
        Scanner obj = new Scanner(System.in);
        int t= obj.nextInt();
        while(t-->0)
        {
        	int a = obj.nextInt();
        	int b = obj.nextInt();
        	int c =obj.nextInt();

        	System.out.println(a+b+c-1);
        }
    }
}


import java.io.BufferedReader;
	import java.io.IOException;
	import java.io.InputStreamReader;
	import java.util.*;
	public class Fence {
		static class FastReader
		{
			BufferedReader br;
			StringTokenizer st;

			public FastReader()
			{
				br = new BufferedReader(new
						InputStreamReader(System.in));
			}

			String next()
			{
				while (st == null || !st.hasMoreElements())
				{
					try
					{
						st = new StringTokenizer(br.readLine());
					}
					catch (IOException e)
					{
						e.printStackTrace();
					}
				}
				return st.nextToken();
			}

			int nextInt()
			{
				return Integer.parseInt(next());
			}

			long nextLong()
			{
				return Long.parseLong(next());
			}

			double nextDouble()
			{
				return Double.parseDouble(next());
			}

			String nextLine()
			{
				String str = "";
				try
				{
					str = br.readLine();
				}
				catch (IOException e)
				{
					e.printStackTrace();
				}
				return str;
			}
		}

		public static void main(String[] args) {
			FastReader f=new FastReader();
			int t=f.nextInt();
			while(t-->0) {
				long arr[]=new long[3];
				arr[0]=f.nextLong();
				arr[1]=f.nextLong();
				arr[2]=f.nextLong();
				Arrays.sort(arr);
				long ans=(arr[2]-arr[1])+(arr[1]-arr[0]);
				System.out.println(ans);
			}
		}

	}


import java.io.BufferedReader;
	import java.io.IOException;
	import java.io.InputStreamReader;
	import java.util.*;
	public class Fence {
		static class FastReader
		{
			BufferedReader br;
			StringTokenizer st;

			public FastReader()
			{
				br = new BufferedReader(new
						InputStreamReader(System.in));
			}

			String next()
			{
				while (st == null || !st.hasMoreElements())
				{
					try
					{
						st = new StringTokenizer(br.readLine());
					}
					catch (IOException e)
					{
						e.printStackTrace();
					}
				}
				return st.nextToken();
			}

			int nextInt()
			{
				return Integer.parseInt(next());
			}

			long nextLong()
			{
				return Long.parseLong(next());
			}

			double nextDouble()
			{
				return Double.parseDouble(next());
			}

			String nextLine()
			{
				String str = "";
				try
				{
					str = br.readLine();
				}
				catch (IOException e)
				{
					e.printStackTrace();
				}
				return str;
			}
		}

		public static void main(String[] args) {
			FastReader f=new FastReader();
			int t=f.nextInt();
			while(t-->0) {
				long a=f.nextLong();
				long b=f.nextLong();
				long c=f.nextLong();
				System.out.println(a+b+c-1);
			}
		}

	}


import java.io.BufferedReader;
	import java.io.IOException;
	import java.io.InputStreamReader;
	import java.util.*;
	public class Fence {
		static class FastReader
		{
			BufferedReader br;
			StringTokenizer st;

			public FastReader()
			{
				br = new BufferedReader(new
						InputStreamReader(System.in));
			}

			String next()
			{
				while (st == null || !st.hasMoreElements())
				{
					try
					{
						st = new StringTokenizer(br.readLine());
					}
					catch (IOException e)
					{
						e.printStackTrace();
					}
				}
				return st.nextToken();
			}

			int nextInt()
			{
				return Integer.parseInt(next());
			}

			long nextLong()
			{
				return Long.parseLong(next());
			}

			double nextDouble()
			{
				return Double.parseDouble(next());
			}

			String nextLine()
			{
				String str = "";
				try
				{
					str = br.readLine();
				}
				catch (IOException e)
				{
					e.printStackTrace();
				}
				return str;
			}
		}

		public static void main(String[] args) {
			FastReader f=new FastReader();
			int t=f.nextInt();
			while(t-->0) {
				int a=f.nextInt();
				int b=f.nextInt();
				int c=f.nextInt();
				int min=Math.min(a,Math.min(c, b));
				int l=min;
				int r=1000000000;
				int mid=0;
				while(l<r) {
					mid=l+(r-l)/2;
					if(a+b+c>mid) break;
					else l=mid+1;
				}
				System.out.println(mid);
			}
		}

	}


import java.io.BufferedReader;
	import java.io.IOException;
	import java.io.InputStreamReader;
	import java.util.*;
	public class Fence {
		static class FastReader
		{
			BufferedReader br;
			StringTokenizer st;

			public FastReader()
			{
				br = new BufferedReader(new
						InputStreamReader(System.in));
			}

			String next()
			{
				while (st == null || !st.hasMoreElements())
				{
					try
					{
						st = new StringTokenizer(br.readLine());
					}
					catch (IOException e)
					{
						e.printStackTrace();
					}
				}
				return st.nextToken();
			}

			int nextInt()
			{
				return Integer.parseInt(next());
			}

			long nextLong()
			{
				return Long.parseLong(next());
			}

			double nextDouble()
			{
				return Double.parseDouble(next());
			}

			String nextLine()
			{
				String str = "";
				try
				{
					str = br.readLine();
				}
				catch (IOException e)
				{
					e.printStackTrace();
				}
				return str;
			}
		}

		public static void main(String[] args) {
			FastReader f=new FastReader();
			int t=f.nextInt();
			while(t-->0) {
				int a=f.nextInt();
				int b=f.nextInt();
				int c=f.nextInt();
				System.out.println((a+b+c)/2);

			}
		}

	}


	import java.io.BufferedReader;
	import java.io.IOException;
	import java.io.InputStreamReader;
	import java.util.*;
	public class Fence {
		static class FastReader
		{
			BufferedReader br;
			StringTokenizer st;

			public FastReader()
			{
				br = new BufferedReader(new
						InputStreamReader(System.in));
			}

			String next()
			{
				while (st == null || !st.hasMoreElements())
				{
					try
					{
						st = new StringTokenizer(br.readLine());
					}
					catch (IOException e)
					{
						e.printStackTrace();
					}
				}
				return st.nextToken();
			}

			int nextInt()
			{
				return Integer.parseInt(next());
			}

			long nextLong()
			{
				return Long.parseLong(next());
			}

			double nextDouble()
			{
				return Double.parseDouble(next());
			}

			String nextLine()
			{
				String str = "";
				try
				{
					str = br.readLine();
				}
				catch (IOException e)
				{
					e.printStackTrace();
				}
				return str;
			}
		}

		public static void main(String[] args) {
			FastReader f=new FastReader();
			int t=f.nextInt();
			while(t-->0) {
				int a=f.nextInt();
				int b=f.nextInt();
				int c=f.nextInt();
				int min=Math.min(a,Math.min(c, b));
				while(true) {
					min++;
					if(min!=a&&min!=b&&min!=c) break;
				}
				System.out.println(min);
			}
		}

	}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
public class Fence {
	static class FastReader
	{
		BufferedReader br;
		StringTokenizer st;

		public FastReader()
		{
			br = new BufferedReader(new
					InputStreamReader(System.in));
		}

		String next()
		{
			while (st == null || !st.hasMoreElements())
			{
				try
				{
					st = new StringTokenizer(br.readLine());
				}
				catch (IOException e)
				{
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

		int nextInt()
		{
			return Integer.parseInt(next());
		}

		long nextLong()
		{
			return Long.parseLong(next());
		}

		double nextDouble()
		{
			return Double.parseDouble(next());
		}

		String nextLine()
		{
			String str = "";
			try
			{
				str = br.readLine();
			}
			catch (IOException e)
			{
				e.printStackTrace();
			}
			return str;
		}
	}

	public static void main(String[] args) {
		FastReader f=new FastReader();
		int t=f.nextInt();
		while(t-->0) {
			int a=f.nextInt();
			int b=f.nextInt();
			int c=f.nextInt();
			System.out.println(c+1);
		}
	}

}


import java.io.BufferedReader;
	import java.io.IOException;
	import java.io.InputStreamReader;
	import java.util.*;
	public class Fence {
		static class FastReader
		{
			BufferedReader br;
			StringTokenizer st;

			public FastReader()
			{
				br = new BufferedReader(new
						InputStreamReader(System.in));
			}

			String next()
			{
				while (st == null || !st.hasMoreElements())
				{
					try
					{
						st = new StringTokenizer(br.readLine());
					}
					catch (IOException e)
					{
						e.printStackTrace();
					}
				}
				return st.nextToken();
			}

			int nextInt()
			{
				return Integer.parseInt(next());
			}

			long nextLong()
			{
				return Long.parseLong(next());
			}

			double nextDouble()
			{
				return Double.parseDouble(next());
			}

			String nextLine()
			{
				String str = "";
				try
				{
					str = br.readLine();
				}
				catch (IOException e)
				{
					e.printStackTrace();
				}
				return str;
			}
		}

		public static void main(String[] args) {
			FastReader f=new FastReader();
			int t=f.nextInt();
			while(t-->0) {
				int a=f.nextInt();
				int b=f.nextInt();
				int c=f.nextInt();
				int min=Math.min(a,Math.min(c, b));
				while(true) {
					min++;
					if(min!=a&&min!=b&&min!=c&&a+b+c>min&&b+c+min>a&&a+c+min>b&&a+b+min>c) break;
				}
				System.out.println(min);
			}
		}

	}


import java.util.*;
public class Codeforces{
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int t=sc.nextInt();
		for(int i=0;i<t;i++) {
			int a=sc.nextInt();
			int b=sc.nextInt();
			int c=sc.nextInt();
			System.out.println(a+b+c-1);
		}
	}
}


import java.util.*;
public class Codeforces{
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int t=sc.nextInt();
		for(int i=0;i<t;i++) {
			int a=sc.nextInt();
			int b=sc.nextInt();
			int c=sc.nextInt();
			if(a+b-c<0) {
				System.out.println("1");
			}
			else {
				System.out.println(a+b-c+1);
			}
		}
	}
}


import java.util.*;
public class Codeforces{
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int t=sc.nextInt();
		for(int i=0;i<t;i++) {
			long a=sc.nextInt();
			long b=sc.nextInt();
			long c=sc.nextInt();
			long d=a+b+c-1;
			System.out.println(d);
		}
	}
}


// package codeforces;

import java.io.*;
import java.util.*;

public class A {
	static FastReader sc=new FastReader();

	public static void main(String[] args) {
		sc=new FastReader();
		int t=sc.nextInt();
		while(t-->0) {
			int a[]=sc.readArray(3);
			Arrays.sort(a);
			System.out.println(a[2]);

		}

	}

	static void print(int a[]) {
		for(int e:a) {
			System.out.print(e+" ");
		}
		System.out.println();
	}
	static class FastReader
    {
        BufferedReader br;
        StringTokenizer st;

        public FastReader()
        {
            br = new BufferedReader(new
                     InputStreamReader(System.in));
        }

        String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException  e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt()
        {
            return Integer.parseInt(next());
        }

        long nextLong()
        {
            return Long.parseLong(next());
        }

        double nextDouble()
        {
            return Double.parseDouble(next());
        }

        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
        int[] readArray(int n) {
        	int a[]=new int [n];
    		for(int i=0;i<n;i++) {
    			a[i]=sc.nextInt();
    		}
    		return a;
        }
    }

}


// package codeforces;

import java.io.*;
import java.util.*;

public class A {
	static FastReader sc=new FastReader();

	public static void main(String[] args) {
		sc=new FastReader();
		int t=sc.nextInt();
		while(t-->0) {
			int a[]=sc.readArray(3);
			Arrays.sort(a);
			System.out.println((a[0]+a[2])/2);

		}

	}

	static void print(int a[]) {
		for(int e:a) {
			System.out.print(e+" ");
		}
		System.out.println();
	}
	static class FastReader
    {
        BufferedReader br;
        StringTokenizer st;

        public FastReader()
        {
            br = new BufferedReader(new
                     InputStreamReader(System.in));
        }

        String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException  e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt()
        {
            return Integer.parseInt(next());
        }

        long nextLong()
        {
            return Long.parseLong(next());
        }

        double nextDouble()
        {
            return Double.parseDouble(next());
        }

        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
        int[] readArray(int n) {
        	int a[]=new int [n];
    		for(int i=0;i<n;i++) {
    			a[i]=sc.nextInt();
    		}
    		return a;
        }
    }

}


// package codeforces;

import java.io.*;
import java.util.*;

public class A {
	static FastReader sc=new FastReader();

	public static void main(String[] args) {
		sc=new FastReader();
		int t=sc.nextInt();
		while(t-->0) {
			int a[]=sc.readArray(3);
			Arrays.sort(a);
			long ans=(long)a[1]*a[1];
			ans+=Math.pow((a[2]-a[0]),2);
			ans=(long)Math.sqrt(ans);
			System.out.println(ans);

		}

	}

	static void print(int a[]) {
		for(int e:a) {
			System.out.print(e+" ");
		}
		System.out.println();
	}
	static class FastReader
    {
        BufferedReader br;
        StringTokenizer st;

        public FastReader()
        {
            br = new BufferedReader(new
                     InputStreamReader(System.in));
        }

        String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException  e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt()
        {
            return Integer.parseInt(next());
        }

        long nextLong()
        {
            return Long.parseLong(next());
        }

        double nextDouble()
        {
            return Double.parseDouble(next());
        }

        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
        int[] readArray(int n) {
        	int a[]=new int [n];
    		for(int i=0;i<n;i++) {
    			a[i]=sc.nextInt();
    		}
    		return a;
        }
    }

}


import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Solution {

    private static Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int t = 0;
        if (sc.hasNext())
            t = sc.nextInt();
        for (int i = 1; i <= t; i++) {
            int n = sc.nextInt();
            long sum = 0;
            for (int j = 0; j < 3; j++) {
                sum += sc.nextInt();
            }
            System.out.println(sum - 1);
            //   solve(n, a);
        }
    }

    private static void solve(int n, int[] a) {
        HashMap<Integer, Integer> h = new HashMap<>();
        System.out.println(Arrays.toString(a));
        int[] last = new int[1000000];
        for (int i = 0; i < n; i++) {
            if (h.containsKey(a[i])) {
                int x = h.get(a[i]);
                int new_x = Math.max(i - x + 1, x);
                h.put(a[i], new_x);
            } else {
                h.put(a[i], i + 1);
            }
            last[a[i]] = i;
        }
        for (int i = 0; i < n; i++) {
            h.put(a[i], Math.max(n - last[a[i]], h.get(a[i])));
        }
        int[] ans = new int[n];
        Arrays.fill(ans, -1);
        for (Map.Entry mapElement : h.entrySet()) {
            int key = (int) mapElement.getKey();
            int value = ((int) mapElement.getValue());
            if (ans[value - 1] == -1)
                ans[value - 1] = key;
            else
                ans[value - 1] = Math.min(key, ans[value - 1]);
        }
        int last_ans = -1;
        for (int i = 0; i < n; i++) {
            if (ans[i] == -1)
                ans[i] = last_ans;
            last_ans = ans[i];
        }
        System.out.println(h);
        System.out.println(Arrays.toString(ans));
    }
}


import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Solution {

    private static Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int t = 0;
        if (sc.hasNext())
            t = sc.nextInt();
        for (int i = 1; i <= t; i++) {
            int n = sc.nextInt();
            int sum = 0;
            for (int j = 0; j < n; j++) {
                sum += sc.nextInt();
            }
            System.out.println(sum - 1);
            //   solve(n, a);
        }
    }

    private static void solve(int n, int[] a) {
        HashMap<Integer, Integer> h = new HashMap<>();
        System.out.println(Arrays.toString(a));
        int[] last = new int[1000000];
        for (int i = 0; i < n; i++) {
            if (h.containsKey(a[i])) {
                int x = h.get(a[i]);
                int new_x = Math.max(i - x + 1, x);
                h.put(a[i], new_x);
            } else {
                h.put(a[i], i + 1);
            }
            last[a[i]] = i;
        }
        for (int i = 0; i < n; i++) {
            h.put(a[i], Math.max(n - last[a[i]], h.get(a[i])));
        }
        int[] ans = new int[n];
        Arrays.fill(ans, -1);
        for (Map.Entry mapElement : h.entrySet()) {
            int key = (int) mapElement.getKey();
            int value = ((int) mapElement.getValue());
            if (ans[value - 1] == -1)
                ans[value - 1] = key;
            else
                ans[value - 1] = Math.min(key, ans[value - 1]);
        }
        int last_ans = -1;
        for (int i = 0; i < n; i++) {
            if (ans[i] == -1)
                ans[i] = last_ans;
            last_ans = ans[i];
        }
        System.out.println(h);
        System.out.println(Arrays.toString(ans));
    }
}


import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Solution {

    private static Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int t = 0;
        if (sc.hasNext())
            t = sc.nextInt();
        for (int i = 1; i <= t; i++) {
            int n = sc.nextInt();
            long sum = 0;
            for (int j = 0; j < n; j++) {
                sum += sc.nextInt();
            }
            System.out.println(sum - 1);
            //   solve(n, a);
        }
    }

    private static void solve(int n, int[] a) {
        HashMap<Integer, Integer> h = new HashMap<>();
        System.out.println(Arrays.toString(a));
        int[] last = new int[1000000];
        for (int i = 0; i < n; i++) {
            if (h.containsKey(a[i])) {
                int x = h.get(a[i]);
                int new_x = Math.max(i - x + 1, x);
                h.put(a[i], new_x);
            } else {
                h.put(a[i], i + 1);
            }
            last[a[i]] = i;
        }
        for (int i = 0; i < n; i++) {
            h.put(a[i], Math.max(n - last[a[i]], h.get(a[i])));
        }
        int[] ans = new int[n];
        Arrays.fill(ans, -1);
        for (Map.Entry mapElement : h.entrySet()) {
            int key = (int) mapElement.getKey();
            int value = ((int) mapElement.getValue());
            if (ans[value - 1] == -1)
                ans[value - 1] = key;
            else
                ans[value - 1] = Math.min(key, ans[value - 1]);
        }
        int last_ans = -1;
        for (int i = 0; i < n; i++) {
            if (ans[i] == -1)
                ans[i] = last_ans;
            last_ans = ans[i];
        }
        System.out.println(h);
        System.out.println(Arrays.toString(ans));
    }
}


import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Solution {

    private static Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int t = 0;
        if (sc.hasNext())
            t = sc.nextInt();
        for (int i = 1; i <= t; i++) {
         //   int n = sc.nextInt();
            long sum = 0;
            for (int j = 0; j < 3; j++) {
                sum += sc.nextInt();
            }
            System.out.println(sum - 1);
            //   solve(n, a);
        }
    }

    private static void solve(int n, int[] a) {
        HashMap<Integer, Integer> h = new HashMap<>();
        System.out.println(Arrays.toString(a));
        int[] last = new int[1000000];
        for (int i = 0; i < n; i++) {
            if (h.containsKey(a[i])) {
                int x = h.get(a[i]);
                int new_x = Math.max(i - x + 1, x);
                h.put(a[i], new_x);
            } else {
                h.put(a[i], i + 1);
            }
            last[a[i]] = i;
        }
        for (int i = 0; i < n; i++) {
            h.put(a[i], Math.max(n - last[a[i]], h.get(a[i])));
        }
        int[] ans = new int[n];
        Arrays.fill(ans, -1);
        for (Map.Entry mapElement : h.entrySet()) {
            int key = (int) mapElement.getKey();
            int value = ((int) mapElement.getValue());
            if (ans[value - 1] == -1)
                ans[value - 1] = key;
            else
                ans[value - 1] = Math.min(key, ans[value - 1]);
        }
        int last_ans = -1;
        for (int i = 0; i < n; i++) {
            if (ans[i] == -1)
                ans[i] = last_ans;
            last_ans = ans[i];
        }
        System.out.println(h);
        System.out.println(Arrays.toString(ans));
    }
}


import java.io.*;
import java.util.*;
public class A
{
	static Reader sc=new Reader();
    static PrintWriter out=new PrintWriter((System.out));
    public static void main(String args[])throws IOException
    {
        int t=sc.nextInt();
        while(t-->0)
        {
            solve();
        }
	out.close();
    }

    public static void solve()
    {
    	int a = sc.nextInt(), b= sc.nextInt(), c = sc.nextInt();
    	System.out.println((a+b+c)/3);
    }

    static class Reader
    {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st=new StringTokenizer("");
        public String next()
        {
            while(!st.hasMoreTokens())
            {
                try
                {
                    st=new StringTokenizer(br.readLine());
                }
                catch(Exception e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }
        public int nextInt()
        {
            return Integer.parseInt(next());
        }
        public long nextLong()
        {
            return Long.parseLong(next());
        }
        public double nextDouble()
        {
            return Double.parseDouble(next());
        }
        public String nextLine()
        {
            try
            {
                return br.readLine();
            }
            catch(Exception e)
            {
                e.printStackTrace();
            }
            return null;
        }
        public boolean hasNext()
        {
            String next=null;
            try
            {
                next=br.readLine();
            }
            catch(Exception e)
            {
            }
            if(next==null)
            {
                return false;
            }
            st=new StringTokenizer(next);
            return true;
        }
    }
}


import java.io.*;
import java.util.*;
public class A
{
	static Reader sc=new Reader();
    static PrintWriter out=new PrintWriter((System.out));
    public static void main(String args[])throws IOException
    {
        int t=sc.nextInt();
        while(t-->0)
        {
            solve();
        }
	out.close();
    }

    public static void solve()
    {
    	int a = sc.nextInt(), b= sc.nextInt(), c = sc.nextInt();
    	System.out.println((int)Math.round(Math.sqrt(3*(a*a+b*b+c*c)))-1);
    }

    static class Reader
    {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st=new StringTokenizer("");
        public String next()
        {
            while(!st.hasMoreTokens())
            {
                try
                {
                    st=new StringTokenizer(br.readLine());
                }
                catch(Exception e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }
        public int nextInt()
        {
            return Integer.parseInt(next());
        }
        public long nextLong()
        {
            return Long.parseLong(next());
        }
        public double nextDouble()
        {
            return Double.parseDouble(next());
        }
        public String nextLine()
        {
            try
            {
                return br.readLine();
            }
            catch(Exception e)
            {
                e.printStackTrace();
            }
            return null;
        }
        public boolean hasNext()
        {
            String next=null;
            try
            {
                next=br.readLine();
            }
            catch(Exception e)
            {
            }
            if(next==null)
            {
                return false;
            }
            st=new StringTokenizer(next);
            return true;
        }
    }
}


import java.io.*;
import java.util.*;
public class A
{
	static Reader sc=new Reader();
    static PrintWriter out=new PrintWriter((System.out));
    public static void main(String args[])throws IOException
    {
        int t=sc.nextInt();
        while(t-->0)
        {
            solve();
        }
	out.close();
    }

    public static void solve()
    {
    	int a = sc.nextInt(), b= sc.nextInt(), c = sc.nextInt();
    	System.out.println((a+b+c)-1);
    }

    static class Reader
    {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st=new StringTokenizer("");
        public String next()
        {
            while(!st.hasMoreTokens())
            {
                try
                {
                    st=new StringTokenizer(br.readLine());
                }
                catch(Exception e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }
        public int nextInt()
        {
            return Integer.parseInt(next());
        }
        public long nextLong()
        {
            return Long.parseLong(next());
        }
        public double nextDouble()
        {
            return Double.parseDouble(next());
        }
        public String nextLine()
        {
            try
            {
                return br.readLine();
            }
            catch(Exception e)
            {
                e.printStackTrace();
            }
            return null;
        }
        public boolean hasNext()
        {
            String next=null;
            try
            {
                next=br.readLine();
            }
            catch(Exception e)
            {
            }
            if(next==null)
            {
                return false;
            }
            st=new StringTokenizer(next);
            return true;
        }
    }
}


import java.io.*;
import java.util.*;
public class A
{
	static Reader sc=new Reader();
    static PrintWriter out=new PrintWriter((System.out));
    public static void main(String args[])throws IOException
    {
        int t=sc.nextInt();
        while(t-->0)
        {
            solve();
        }
	out.close();
    }

    public static void solve()
    {
    	int a = sc.nextInt(), b= sc.nextInt(), c = sc.nextInt();
    	System.out.println((int)Math.round(Math.sqrt(3*(a^2+b^2+c^2)))-1);
    }

    static class Reader
    {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st=new StringTokenizer("");
        public String next()
        {
            while(!st.hasMoreTokens())
            {
                try
                {
                    st=new StringTokenizer(br.readLine());
                }
                catch(Exception e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }
        public int nextInt()
        {
            return Integer.parseInt(next());
        }
        public long nextLong()
        {
            return Long.parseLong(next());
        }
        public double nextDouble()
        {
            return Double.parseDouble(next());
        }
        public String nextLine()
        {
            try
            {
                return br.readLine();
            }
            catch(Exception e)
            {
                e.printStackTrace();
            }
            return null;
        }
        public boolean hasNext()
        {
            String next=null;
            try
            {
                next=br.readLine();
            }
            catch(Exception e)
            {
            }
            if(next==null)
            {
                return false;
            }
            st=new StringTokenizer(next);
            return true;
        }
    }
}


import java.io.*;
import java.util.*;
public class A
{
	static Reader sc=new Reader();
    static PrintWriter out=new PrintWriter((System.out));
    public static void main(String args[])throws IOException
    {
        int t=sc.nextInt();
        while(t-->0)
        {
            solve();
        }
	out.close();
    }

    public static void solve()
    {
    	long a = sc.nextLong(), b= sc.nextLong(), c = sc.nextLong();
    	long ans = a+b+c-1;
    	System.out.println(ans);
    }

    static class Reader
    {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st=new StringTokenizer("");
        public String next()
        {
            while(!st.hasMoreTokens())
            {
                try
                {
                    st=new StringTokenizer(br.readLine());
                }
                catch(Exception e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }
        public int nextInt()
        {
            return Integer.parseInt(next());
        }
        public long nextLong()
        {
            return Long.parseLong(next());
        }
        public double nextDouble()
        {
            return Double.parseDouble(next());
        }
        public String nextLine()
        {
            try
            {
                return br.readLine();
            }
            catch(Exception e)
            {
                e.printStackTrace();
            }
            return null;
        }
        public boolean hasNext()
        {
            String next=null;
            try
            {
                next=br.readLine();
            }
            catch(Exception e)
            {
            }
            if(next==null)
            {
                return false;
            }
            st=new StringTokenizer(next);
            return true;
        }
    }
}


import java.io.*;
import java.util.*;
public class A
{
	static Reader sc=new Reader();
    static PrintWriter out=new PrintWriter((System.out));
    public static void main(String args[])throws IOException
    {
        int t=sc.nextInt();
        while(t-->0)
        {
            solve();
        }
	out.close();
    }

    public static void solve()
    {
    	int a = sc.nextInt(), b= sc.nextInt(), c = sc.nextInt();
    	long ans = a+b+c-1;
    	System.out.println(ans);
    }

    static class Reader
    {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st=new StringTokenizer("");
        public String next()
        {
            while(!st.hasMoreTokens())
            {
                try
                {
                    st=new StringTokenizer(br.readLine());
                }
                catch(Exception e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }
        public int nextInt()
        {
            return Integer.parseInt(next());
        }
        public long nextLong()
        {
            return Long.parseLong(next());
        }
        public double nextDouble()
        {
            return Double.parseDouble(next());
        }
        public String nextLine()
        {
            try
            {
                return br.readLine();
            }
            catch(Exception e)
            {
                e.printStackTrace();
            }
            return null;
        }
        public boolean hasNext()
        {
            String next=null;
            try
            {
                next=br.readLine();
            }
            catch(Exception e)
            {
            }
            if(next==null)
            {
                return false;
            }
            st=new StringTokenizer(next);
            return true;
        }
    }
}


import java.io.*;
import java.util.*;
public class A
{
	static Reader sc=new Reader();
    static PrintWriter out=new PrintWriter((System.out));
    public static void main(String args[])throws IOException
    {
        int t=sc.nextInt();
        while(t-->0)
        {
            solve();
        }
	out.close();
    }

    public static void solve()
    {
    	int a = sc.nextInt(), b= sc.nextInt(), c = sc.nextInt();
    	System.out.println(Math.min(a, Math.min(b, c)));
    }

    static class Reader
    {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st=new StringTokenizer("");
        public String next()
        {
            while(!st.hasMoreTokens())
            {
                try
                {
                    st=new StringTokenizer(br.readLine());
                }
                catch(Exception e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }
        public int nextInt()
        {
            return Integer.parseInt(next());
        }
        public long nextLong()
        {
            return Long.parseLong(next());
        }
        public double nextDouble()
        {
            return Double.parseDouble(next());
        }
        public String nextLine()
        {
            try
            {
                return br.readLine();
            }
            catch(Exception e)
            {
                e.printStackTrace();
            }
            return null;
        }
        public boolean hasNext()
        {
            String next=null;
            try
            {
                next=br.readLine();
            }
            catch(Exception e)
            {
            }
            if(next==null)
            {
                return false;
            }
            st=new StringTokenizer(next);
            return true;
        }
    }
}


import java.util.*;

public class cp{
	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int t = sc.nextInt();

		while(t-->0)
		{
			long ar[] = new long[3];

			ar[0] = sc.nextLong();
			ar[1]=sc.nextLong();
			ar[2]=sc.nextLong();

			if(ar[2]>ar[1])
			{
			    long temp = ar[2];
			    ar[2]=ar[1];
			    ar[1]=temp;
			}

			if(ar[1]>ar[0])
			{
			    long temp = ar[0];
			    ar[0]=ar[1];
			    ar[1]=temp;
			}

            //System.out.println(ar[0]+" "+ar[1]+" "+ar[2]);
			System.out.println(ar[0]-ar[1]-ar[2]+1);
		}
	}
}


import java.util.*;

public class cp{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int t = sc.nextInt();

		while(t-->0)
		{
			long a = sc.nextLong();
		long b = sc.nextLong();
		long c = sc.nextLong();

		System.out.println(a+b+c-1);
		}
	}
}


import java.util.*;

public class cp{
	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int t = sc.nextInt();

		while(t-->0)
		{
			long a = sc.nextInt();
			long b = sc.nextInt();
			long c = sc.nextInt();

			long res = a+b+c-Math.max(a,Math.max(b,c))+1;

			System.out.println(res);
		}
	}
}


import java.util.*;
public class fence
{
    public static void main(String args[])
    {
        Scanner sc = new Scanner(System.in);
        int t=sc.nextInt();
        for(int i=0;i<t;i++)
        {
            long a =sc.nextLong();
            long b =sc.nextLong();
            long c =sc.nextLong();
            long d=a+b+c-1;
            System.out.println(d);
        }
    }
}


import java.util.*;
public class fence
{
    public static void main(String args[])
    {
        Scanner sc = new Scanner(System.in);
        int t=sc.nextInt();
        for(int i=0;i<t;i++)
        {
            long a =sc.nextLong();
            long b =sc.nextLong();
            long c =sc.nextLong();
            long d=a+b+c-1;
            System.out.println(d);
        }
    }


import java.util.*;
public class fence
{
    public static void main(String args[])
    {
        Scanner sc = new Scanner(System.in);
        int t=sc.nextInt();
        for(int i=0;i<t;i++)
        {
            int a =sc.nextInt();
            int b =sc.nextInt();
            int c =sc.nextInt();
            int d=a+b+c-1;
            System.out.println(d);
        }
    }
}


import java.util.Scanner;
public class ContestB {

	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);

		int t= sc.nextInt();
		while(t--!=0) {
			int a=sc.nextInt();
			int b=sc.nextInt();
			int c=sc.nextInt();

			double dl=Math.pow((b*b+Math.pow((a-c),2)),0.5);

			System.out.println(dl);
		}
		sc.close();
	}

}


import java.util.Scanner;
public class Solution{
public static void main(String []args)
{Scanner sc=new Scanner(System.in);
int t=sc.nextInt();
while(t--!=0){
int sum=0;
for(int i=0;i<3;i++) sum+=sc.nextInt();
System.out.println(sum-1);
}sc.close();
}}


import java.util.Scanner;
public class ContestB {

	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);

		int t= sc.nextInt();
		while(t--!=0) {

		long sum=sc.nextLong()+sc.nextLong()+sc.nextLong();
		System.out.println(sum-1);
		}
		sc.close();
	}

}


import java.sql.*;
import java.text.*;
import java.util.*;
import java.io.*;

public class fence {

    public static void main(String[] args) throws IOException {

        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter pw = new PrintWriter(System.out);

        StringTokenizer st = new StringTokenizer(br.readLine());

        int n = Integer.parseInt(st.nextToken());

        /* Program: */

        for (int i = 0; i < n; i++) {
            st = new StringTokenizer(br.readLine());
            int a = Integer.parseInt(st.nextToken());
            int b = Integer.parseInt(st.nextToken());
            int c = Integer.parseInt(st.nextToken());

            int[] arr = {a, b, c};
            Arrays.sort(arr);
            pw.println(Math.max(0, c - a - b + 1));
        }

        pw.close();
        br.close();
    }

}


import java.sql.*;
import java.text.*;
import java.util.*;
import java.io.*;

public class fence {

    public static void main(String[] args) throws IOException {

        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter pw = new PrintWriter(System.out);

        StringTokenizer st = new StringTokenizer(br.readLine());

        int n = Integer.parseInt(st.nextToken());

        /* Program: */

        for (int i = 0; i < n; i++) {
            st = new StringTokenizer(br.readLine());
            int a = Integer.parseInt(st.nextToken());
            int b = Integer.parseInt(st.nextToken());
            int c = Integer.parseInt(st.nextToken());

            for (int j = 1; j <= Math.pow(10, 9); j++) {
                if (a + b + c > j && a + b + j > c && b + j + c > a && a + c + j > b) {
                    pw.println(j);
                    break;
                }
            }
        }

        pw.close();
        br.close();
    }

}


import java.sql.*;
import java.text.*;
import java.util.*;
import java.io.*;

public class fence {

    public static void main(String[] args) throws IOException {

        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter pw = new PrintWriter(System.out);

        StringTokenizer st = new StringTokenizer(br.readLine());

        int n = Integer.parseInt(st.nextToken());

        /* Program: */

        for (int i = 0; i < n; i++) {
            st = new StringTokenizer(br.readLine());
            int[] arr = {Integer.parseInt(st.nextToken()), Integer.parseInt(st.nextToken()),
                    Integer.parseInt(st.nextToken())};
            Arrays.sort(arr);
            pw.println(Math.max(1, arr[2] - arr[1] - arr[0] + 1));
        }

        pw.close();
        br.close();
    }

}


import java.sql.*;
import java.text.*;
import java.util.*;
import java.io.*;

public class fence {

    public static void main(String[] args) throws IOException {

        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter pw = new PrintWriter(System.out);

        StringTokenizer st = new StringTokenizer(br.readLine());

        int n = Integer.parseInt(st.nextToken());

        /* Program: */

        for (int i = 0; i < n; i++) {
            st = new StringTokenizer(br.readLine());
            int a = Integer.parseInt(st.nextToken());
            int b = Integer.parseInt(st.nextToken());
            int c = Integer.parseInt(st.nextToken());

            int[] arr = {a, b, c};
            Arrays.sort(arr);
            pw.println(Math.max(1, c - a - b + 1));
        }

        pw.close();
        br.close();
    }

}


import java.sql.*;
import java.text.*;
import java.util.*;
import java.io.*;

public class niceMatrix {

    public static void main(String[] args) throws IOException {

        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter pw = new PrintWriter(System.out);

        StringTokenizer st = new StringTokenizer(br.readLine());

        int t = Integer.parseInt(st.nextToken());

        /* Program: split each column/row in half and floor, then make all 4 symmetric vertices equal. If m/n is odd, make their row/column equal too. */

        for (int i = 0; i < t; i++) {
            st = new StringTokenizer(br.readLine());
            int moves = 0;
            int n = Integer.parseInt(st.nextToken());
            int m = Integer.parseInt(st.nextToken());
            int[][] arr = new int[n][m];
            for (int j = 0; j < n; j++) {
                st = new StringTokenizer(br.readLine());
                for (int k = 0; k < m; k++) {
                    arr[j][k] = Integer.parseInt(st.nextToken());
                }
            }
            for (int j = 0; j < (int)(n / 2); j++) {
                for (int k = 0; k < (int)(m / 2); k++) {
                    int topLeft = arr[j][k];
                    int bottomLeft = arr[n - j - 1][k];
                    int topRight = arr[j][m - k - 1];
                    int bottomRight = arr[n - j - 1][m - k - 1];
                    int average = Math.max(Math.min(topLeft, bottomLeft), Math.min(topRight, bottomRight));
                    moves += (Math.abs(average - topLeft) + Math.abs(average - topRight) + Math.abs(average - bottomLeft) + Math.abs(average - bottomRight));
                }
            }
            if (n % 2 == 1) {
                for (int j = 0; j < (int)(m / 2); j++) {
                    int left = arr[(n) / 2][j];
                    int right = arr[(n) / 2][m - j - 1];
                    moves += Math.abs(left - right);
                }
            } if (m % 2 == 1) {
                for (int j = 0; j < (int)(n / 2); j++) {
                    int left = arr[j][(m) / 2];
                    int right = arr[n - j - 1][(m) / 2];
                    moves += Math.abs(left - right);
                }
            }
            pw.println(moves);
        }

        pw.close();
        br.close();
    }

}


import java.sql.*;
import java.text.*;
import java.util.*;
import java.io.*;

public class fence {

    public static void main(String[] args) throws IOException {

        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter pw = new PrintWriter(System.out);

        StringTokenizer st = new StringTokenizer(br.readLine());

        int n = Integer.parseInt(st.nextToken());

        /* Program: */

        for (int i = 0; i < n; i++) {
            st = new StringTokenizer(br.readLine());
            int a = Integer.parseInt(st.nextToken());
            int b = Integer.parseInt(st.nextToken());
            int c = Integer.parseInt(st.nextToken());

            int[] arr = {a, b, c};
            Arrays.sort(arr);
            pw.println(c - a - b + 1);
        }

        pw.close();
        br.close();
    }

}


//package Main_package;

import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner read = new Scanner(System.in);
        int t = read.nextInt();
        for(int i = 0; i < t; i++) {
            int a = read.nextInt(), b = read.nextInt(), c = read.nextInt();
            System.out.println(a + b + c);
        }
    }
}

/*
d <= (a + b + c)
 */


//package Main_package;

import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner read = new Scanner(System.in);
        int t = read.nextInt();
        for(int i = 0; i < t; i++) {
            int a = read.nextInt(), b = read.nextInt(), c = read.nextInt();
            System.out.println((a + b + c) - 1);
        }
    }
}

/*
d <= (a + b + c)
 */


//package Main_package;

import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner read = new Scanner(System.in);
        int t = read.nextInt();
        for(int i = 0; i < t; i++) {
            int a = read.nextInt(), b = read.nextInt(), c = read.nextInt();
            int result = Math.max(a,b);
            result = Math.max(result,c);
            System.out.println(result);
        }
    }
}

/*
d <= (a + b + c)
 */


import java.util.*;
import java.lang.String;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int t = scanner.nextInt();
        for (int i = 0; i < t; i++) {
            int a =scanner.nextInt();
            int b =scanner.nextInt();
            int c =scanner.nextInt();
            System.out.println();
            System.out.println(1+Math.random()*(a+b+c));
            System.out.println(1+Math.random()*(a+b+c));
        }


import java.util.*;
import java.lang.String;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int t = scanner.nextInt();
        int a = scanner.nextInt();
        int a1 = scanner.nextInt();
        int a2 = scanner.nextInt();
        int a3 = scanner.nextInt();
        int a4 = scanner.nextInt();
        int a5 = scanner.nextInt();
        int k = a+a1+a2;
        int k1 = a3+a4+a5;
        System.out.println(k-1);
        System.out.println(k1-1);
    }
}


import java.util.*;
import java.lang.String;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int t = scanner.nextInt();
        for (int i = 0; i < t; i++) {
            int a =scanner.nextInt();
            int b =scanner.nextInt();
            int c =scanner.nextInt();
            System.out.println(1+Math.random()*(a+b+c));
            System.out.println(1+Math.random()*(a+b+c));
        }


import java.util.*;
import java.lang.String;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
       long t = scanner.nextLong();
        while(t!=0){
            long a = scanner.nextLong();
            long b = scanner.nextLong();
            long c = scanner.nextLong();
            System.out.println((a+b+c)-1);
            t--;
        }

    }
}


import java.util.*;

public class Program{
    public static void main(String args[]){
		Scanner in = new Scanner(System.in);

		long n = in.nextInt();
		long a, b, c, d;
		for(int i = 0;i<n;i++){
			a = in.nextInt();
			b = in.nextInt();
			c = in.nextInt();
			d = a + b + c - 1;

			System.out.println(d);
		}

    }
}


import java.util.*;

public class Program{
    public static void main(String args[]){
		Scanner in = new Scanner(System.in);

		int n = in.nextInt();
		int a, b, c, d;
		for(int i = 0;i<n;i++){
			a = in.nextInt();
			b = in.nextInt();
			c = in.nextInt();
			d = a + b + c - 1;

			System.out.println(d);
		}

    }
}


import java.util.*;

public class Solution {
	public static void main(String args[]) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		for(int i = 0;i<n;i++) {

		int a, b, c, d;

		a = in.nextInt();
		b = in.nextInt();
		c = in.nextInt();

		int dd  =c - b;
		int ee = b - a;

		if(dd == ee) {
			d = c + ee;
		}
		else {
			int t = Math.abs(ee - dd);
			d =c + (ee - t);
		}
		System.out.println(d);
		}
	}
}


import java.util.*;
public class Main
{
	public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int t=sc.nextInt();
        while(t--!=0)
        {
            int a=sc.nextInt();
            int b=sc.nextInt();
            int c=sc.nextInt();

            if(a==b)
            {
                System.out.println(c);
            }
            else if(b==c)
            {
                System.out.println(a);
            }
            else if(a==c)
            {
                System.out.println(b);
            }
            else
            {
                int arr[] = new int[3];

                long max=a+b+c;

                arr[0]=a-b-c;

                arr[1]=b-a-c;
                arr[2]=c-a-b;

                Arrays.sort(arr);

                int min= arr[2];

                System.out.println((min+max)/2);

            }
        }
	}

}


import java.util.*;
public class Main
{
	public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int t=sc.nextInt();
        while(t--!=0)
        {
            int a=sc.nextInt();
            int b=sc.nextInt();
            int c=sc.nextInt();

            if(a==b)
            {
                System.out.println(c);
            }
            else if(b==c)
            {
                System.out.println(a);
            }
            else if(a==c)
            {
                System.out.println(b);
            }
            else
            {
                    System.out.println(a+b+c-1);

            }
        }
	}

}


import java.util.*;
public class Main
{
	public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int t=sc.nextInt();
        while(t--!=0)
        {
            long a=sc.nextLong();
            long b=sc.nextLong();
            long c=sc.nextLong();

                long max=a+b+c;

                System.out.println((min+max)/2);

        }
	}

}


import java.util.*;
public class Main
{
	public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int t=sc.nextInt();
        while(t--!=0)
        {
            int a=sc.nextInt();
            int b=sc.nextInt();
            int c=sc.nextInt();

            if(a==b)
            {
                System.out.println(c);
            }
            else if(b==c)
            {
                System.out.println(a);
            }
            else if(a==c)
            {
                System.out.println(b);
            }
            else
            {
                int arr[] = new int[3];

                long max=a+b+c;

                arr[0]=a-b-c;

                arr[1]=b-a-c;
                arr[2]=c-a-b;

                Arrays.sort(arr);

                int min= arr[2];
                if(min<0)
                {
                    min=max-1;
                }
                System.out.println(min);

            }
        }
	}

}


import java.util.*;
public class Main
{
	public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int t=sc.nextInt();
        while(t--!=0)
        {
            int a=sc.nextInt();
            int b=sc.nextInt();
            int c=sc.nextInt();

            if(a==b)
            {
                System.out.println(c);
            }
            else if(b==c)
            {
                System.out.println(a);
            }
            else if(a==c)
            {
                System.out.println(b);
            }
            else
            {
                int arr[] = new int[3];

                long max=a+b+c;

                arr[0]=a-b-c;

                arr[1]=b-a-c;
                arr[2]=c-a-b;

                Arrays.sort(arr);

                int min= arr[2];
                if(min<0)
                {
                   System.out.println(max-1);

                }
                else
                {
                    System.out.println(min+1);
                }

            }
        }
	}

}


import java.util.*;
public class Main
{
	public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int t=sc.nextInt();
        while(t--!=0)
        {
            int a=sc.nextInt();
            int b=sc.nextInt();
            int c=sc.nextInt();

                long max=a+b+c;

                System.out.println(max-1);

        }
	}

}


import java.util.*;
public class Main
{
	public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int t=sc.nextInt();
        while(t--!=0)
        {
            int a=sc.nextInt();
            int b=sc.nextInt();
            int c=sc.nextInt();

            int arr[]=new int[3];
            arr[0]=a-b-c;
            arr[1]=b-a-c;
            arr[2]=c-a-b;

            Arrays.sort(arr);

            int max= arr[2];
            System.out.println(max+1);

        }
	}

}


import java.util.*;
public class Main
{
	public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int t=sc.nextInt();
        while(t--!=0)
        {
            int a=sc.nextInt();
            int b=sc.nextInt();
            int c=sc.nextInt();

            if(a==b)
            {
                System.out.println(c);
            }
            else if(b==c)
            {
                System.out.println(a);
            }
            else if(a==c)
            {
                System.out.println(b);
            }
            else
            {
                System.out.println(a+b+c-3);
            }
        }
	}

}


#include<bits/stdc++.h>
#define int long long

using namespace std;

main(){
	int n, k, l;
	cin >> n >> k >> l;
	int array[n*k];
	for(int i = 0; i < n*k; ++i)cin >> array[i];
	sort(array, array + n*k);
	int r = n * k , per = array[0];
	for(int i = 1; i < n * k; ++i){
		if(array[i] - per > l){
			r = i - 1;
//			cout << array[i] << " - array       per- " << per << "      l - " << l <<  "\n";
			break;
		}
	}
//	for(int i = 0; i < n*k; ++i)cout << array[i] << " ";
//	cout << "\n";
//	cout << "\n" << r ;
	if(r + 1 < n)
		cout << "0";
		else{
	int ot = 0;
	for(int i = 1;i < n + 1; ++i){
		if((n - i) <= ((r + 1) - i * k))
			ot += array[(i - 1)*k];
			else {
//				if(l <= ((i - 1)*k - (r + 2 - k)))
				for(int j = (i - 1)*k; j <= (r + 2 - k); j++){
//					cout << "heh\n";
					ot += array[j];
				}
//				if((r + 1) % k != 0){
//					ot+= array[r + 1 - k];
//					break;
//				}
		}
	}
	cout << ot;
	}
}


#include<bits/stdc++.h>
#define int long long

using namespace std;

main(){
	int n, k, l;
	cin >> n >> k >> l;
	int array[n*k];
	for(int i = 0; i < n*k; ++i)cin >> array[i];
	sort(array, array + n*k);
	int r = n * k - 1, per = array[0];
	for(int i = 1; i < n * k; ++i){
		if(array[i] - per > l){
			r = i - 1;
//			cout << array[i] << " - array       per- " << per << "      l - " << l <<  "\n";
			break;
		}
	}
	for(int i = 0; i < n*k; ++i)cout << array[i] << " ";
	cout << "\n";
//	cout << "\n" << r ;
	if(r + 1 < n)
		cout << "0";
		else{
	int ot = 0;
	for(int i = 1;i < n + 1; ++i){
		if((n - i) <= ((r + 1) - i * k))
			ot += array[(i - 1)*k];
			else {
//				if(l <= ((i - 1)*k - (r + 2 - k)))
				for(int j = (i - 1)*k; j <= (r + 2 - k); j++){
//					cout << "heh\n";
					ot += array[j];
				}
//				if((r + 1) % k != 0){
//					ot+= array[r + 1 - k];
//					break;
//				}
		}
	}
	cout << ot;
	}
}


#include<bits/stdc++.h>
#define int long long

using namespace std;

main(){
	int n, k, l;
	cin >> n >> k >> l;
	int array[n*k];
	for(int i = 0; i < n*k; ++i)cin >> array[i];
	sort(array, array + n*k);
	int r = n * k , per = array[0];
	for(int i = 1; i < n * k; ++i){
		if(array[i] - per > l){
			r = i - 1;
//			cout << array[i] << " - array       per- " << per << "      l - " << l <<  "\n";
			break;
		}
	}
//	for(int i = 0; i < n*k; ++i)cout << array[i] << " ";
//	cout << "\n";
//	cout << "\n" << r ;
	if((r + 1 < n ) && (n != 0))
		cout << "0";
		else{
	int ot = 0;
	for(int i = 1;i < n + 1; ++i){
		if((n - i) <= ((r + 1) - i * k))
			ot += array[(i - 1)*k];
			else {
//				if(l <= ((i - 1)*k - (r + 2 - k)))
				for(int j = (i - 1)*k; j <= (r + 2 - k); j++){
//					cout << "heh\n";
					ot += array[j];
				}
//				if((r + 1) % k != 0){
//					ot+= array[r + 1 - k];
//					break;
//				}
		}
	}
	cout << ot;
	}
}


#include<cstdio>
#include<cstring>
#include<string>
#include<algorithm>
#include<stack>
#include<iostream>
#include<queue>
#include<cmath>
#include<set>
#include<cstdlib>
#include<list>
#include<map>
using namespace std;
const int maxn = 2e5 + 10;
const int mod = 1e9 + 7;
const double eps = 1e-7;
typedef long long ll;
ll n, k, l;
ll a[maxn];
void work()
{
	cin >> n >> k >> l;
	for(ll i = 0; i < n * k; i++) scanf("%lld", &a[i]);
	sort(a, a + n * k);
	if(a[n - 1] - a[0] > l)
	{
		printf("0\n");
		return;
	}
	ll ans = 0, cnt = 0;
	ll r = upper_bound(a, a + n * k, a[0] + l) - a;
	if(r > n * k - 1) r = n * k - 1;
	while(r >= 0 && a[r] > a[0] + l) r--;
	ll i;
	for(i = 0; i < n * k; )
	{
		if(i + k + n - cnt - 1 <= r)
		{
			ans += a[i];
			i += k;
			cnt++;
		}
		else break;
	}
	for(; cnt < n; cnt++)
	{
		ans += a[i];
		i++;
	}
	printf("%lld\n", ans);
}
int main()
{
	work();
	return 0;
}


#include<cstdio>
#include<cstring>
#include<string>
#include<algorithm>
#include<stack>
#include<iostream>
#include<queue>
#include<cmath>
#include<set>
#include<cstdlib>
#include<list>
#include<map>
using namespace std;
const int maxn = 1e5 + 10;
const int mod = 1e9 + 7;
const double eps = 1e-7;
typedef long long ll;
ll a[maxn];
ll n, k, l;
ll find(ll x)
{
	ll lr = 0, rr = n * k - 1;
	ll mid;
	while(rr - lr > 5)
	{
		mid = lr + (rr - lr) / 2;
		if(a[mid] > x) rr = mid;
		else lr = mid;
	}
	while(lr <= rr && a[lr] <= x) lr++;
	return lr - 1;
}
void judge()
{
	ll r;
	if(a[n * k - 1] > a[0] + l)
	{
		//r = upper_bound(a, a + n * k, a[0] + l) - a;
		r = find(a[0] + l);
	}
//	else if(a[n * k - 1] == a[0] + l) r = n * k - 1;
	else r = n * k - 1;
//	if(a[r] > a[0] + l) r--;
//	printf("r:%lld\n", r);
	ll ans = 0;
	ll cnt = 1;
	for(ll i = 0; i < n * k; )
	{

		if(i + k + n - cnt - 1<= r)
		{
			ans += a[i];
			cnt++;
			i += k;//printf("i:%lld n:%lld k:%lld cnt:%lld ans:%lld\n", i, n, k, cnt, ans);
		}
		else
		{
			for(ll j = r; ; j--)
			{
				if(cnt > n) break;
				ans += a[j];
				cnt++;
			}
			break;
		}
	}
//	printf("cnt:%lld\n", cnt);
	//for(ll i = cnt; i < n; i++) ans += a[i];
	printf("%lld\n", ans);
}
void work()
{
	cin >> n >> k >> l;
	for(ll i = 0; i < n * k; i++)
	{
		scanf("%lld", &a[i]);
	}
	sort(a, a + n * k);
	if(a[n - 1] - a[0] > l)
	{
		printf("0\n");
		return;
	}
	judge();
}
int main()
{
	work();
	return 0;
}
/*
4 2 10
2 2 1 2 3 2 2 3

*/