description: Tanya is learning how to add numbers, but so far she is not doing it correctly. She is adding two numbers a and b using the following algorithm:
  
    1. If one of the numbers is shorter than the other, Tanya adds leading zeros so that the numbers are the same length. 
    2. The numbers are processed from right to left (that is, from the least significant digits to the most significant). 
    3. In the first step, she adds the last digit of a to the last digit of b and writes their sum in the answer. 
    4. At each next step, she performs the same operation on each pair of digits in the same place and writes the result to the left side of the answer. 
  
  
  
  For example, the numbers a = 17236 and b = 3465 Tanya adds up as follows:
  
  $$$ \large{ \begin{array}{r} + \begin{array}{r} 17236\\\ 03465\\\ \end{array} \\\ \hline \begin{array}{r} 1106911 \end{array} \end{array}} $$$
  
    * calculates the sum of 6 + 5 = 11 and writes 11 in the answer. 
    * calculates the sum of 3 + 6 = 9 and writes the result to the left side of the answer to get 911. 
    * calculates the sum of 2 + 4 = 6 and writes the result to the left side of the answer to get 6911. 
    * calculates the sum of 7 + 3 = 10, and writes the result to the left side of the answer to get 106911. 
    * calculates the sum of 1 + 0 = 1 and writes the result to the left side of the answer and get 1106911. 
  
  
  
  As a result, she gets 1106911.
  
  You are given two positive integers a and s. Find the number b such that by adding a and b as described above, Tanya will get s. Or determine that no suitable b exists.
  
  Input
  
  The first line of input data contains an integer t (1 ≤ t ≤ 10^4) — the number of test cases.
  
  Each test case consists of a single line containing two positive integers a and s (1 ≤ a < s ≤ 10^{18}) separated by a space.
  
  Output
  
  For each test case print the answer on a separate line.
  
  If the solution exists, print a single positive integer b. The answer must be written without leading zeros. If multiple answers exist, print any of them.
  
  If no suitable number b exists, output -1.
  
  Example
  
  Input
  
  
  6
  17236 1106911
  1 5
  108 112
  12345 1023412
  1 11
  1 20
  
  
  Output
  
  
  3465
  4
  -1
  90007
  10
  -1
  
  Note
  
  The first test case is explained in the main part of the statement.
  
  In the third test case, we cannot choose b that satisfies the problem statement.
solution: import java.util.*;
  import java.lang.*;
  import java.io.*;
  
  public class Codechef {
  	static long fans[] = new long[200001];
  	static long inv[] = new long[200001];
  	static long mod = 1000000007;
  
  	static void init() {
  		fans[0] = 1;
  		inv[0] = 1;
  		fans[1] = 1;
  		inv[1] = 1;
  		for (int i = 2; i < 200001; i++) {
  			fans[i] = ((long) i * fans[i - 1]) % mod;
  			inv[i] = power(fans[i], mod - 2);
  		}
  	}
  
  	static long ncr(int n, int r) {
  		return (((fans[n] * inv[n - r]) % mod) * (inv[r])) % mod;
  	}
  
  	public static void main(String[] args) throws java.lang.Exception {
  		FastReader in = new FastReader(System.in);
  		StringBuilder sb = new StringBuilder();
  		int t = 1;
  		t = in.nextInt();
  		while (t > 0) {
  			--t;
  			String a = in.next();
  			String s = in.next();
  			int len1 = a.length();
  			int len2 = s.length();
  			while(a.length()<s.length())
  				a = '0'+a;
  			StringBuilder ans = new StringBuilder();
  			int i = a.length()-1;
  			int j = s.length()-1;
  			while(i>=0 && j>=0)
  			{
  				int e1 = a.charAt(i)-'0';
  				int e2 = s.charAt(j)-'0';
  				if(e2>=e1)
  				{
  					ans.append(e2-e1);
  					j-=1;
  					--len2;
  				}
  				else
  				{
  					if(j-1<0 || s.charAt(j-1) == '0') 
  						break;
  					int val = (s.charAt(j-1)-'0')*10+e2;
  					int temp = val - e1;
  					if(temp>=10)
  						break;
  					ans.append(temp);
  					j-=2;
  					len2-=2;
  				}
  				i-=1;
  				len1-=1;
  			}
  			if(len1<=0 && len2 <=0)
  			{
  				while(ans.charAt(ans.length()-1) == '0')
  					ans.setLength(ans.length()-1);
  				sb.append(ans.reverse()+"\n");
  			}
  			else
  				sb.append("-1\n");
  
  		}
  		System.out.print(sb);
  	}
  
  	static long power(long x, long y) {
  		long res = 1; // Initialize result
  
  		while (y > 0) {
  
  			// If y is odd, multiply x with result
  			if ((y & 1) != 0)
  				res = ((res % mod) * (x % mod)) % mod;
  
  			// y must be even now
  			y = y >> 1; // y = y/2
  			x = ((x % mod) * (x % mod)) % mod; // Change x to x^2
  		}
  		return res;
  	}
  
  	static long[] generateArray(FastReader in, int n) throws IOException {
  		long arr[] = new long[n];
  		for (int i = 0; i < n; i++)
  			arr[i] = in.nextLong();
  		return arr;
  	}
  
  	static long[][] generatematrix(FastReader in, int n, int m) throws IOException {
  		long arr[][] = new long[n][m];
  		for (int i = 0; i < n; i++) {
  			for (int j = 0; j < m; j++) {
  				arr[i][j] = in.nextLong();
  			}
  		}
  		return arr;
  	}
  
  	static long gcd(long a, long b) {
  		if (a == 0)
  			return b;
  		else
  			return gcd(b % a, a);
  	}
  
  	static long lcm(long a, long b) {
  		return (a / gcd(a, b)) * b;
  	}
  
  	static void sort(long[] a) {
  		ArrayList<Long> l = new ArrayList<>();
  		for (long i : a)
  			l.add(i);
  		Collections.sort(l);
  		for (int i = 0; i < a.length; i++)
  			a[i] = l.get(i);
  	}
  }
  
  class FastReader {
  
  	byte[] buf = new byte[2048];
  	int index, total;
  	InputStream in;
  
  	FastReader(InputStream is) {
  		in = is;
  	}
  
  	int scan() throws IOException {
  		if (index >= total) {
  			index = 0;
  			total = in.read(buf);
  			if (total <= 0) {
  				return -1;
  			}
  		}
  		return buf[index++];
  	}
  
  	String next() throws IOException {
  		int c;
  		for (c = scan(); c <= 32; c = scan())
  			;
  		StringBuilder sb = new StringBuilder();
  		for (; c > 32; c = scan()) {
  			sb.append((char) c);
  		}
  		return sb.toString();
  	}
  
  	String nextLine() throws IOException {
  		int c;
  		for (c = scan(); c <= 32; c = scan())
  			;
  		StringBuilder sb = new StringBuilder();
  		for (; c != 10 && c != 13; c = scan()) {
  			sb.append((char) c);
  		}
  		return sb.toString();
  	}
  
  	char nextChar() throws IOException {
  		int c;
  		for (c = scan(); c <= 32; c = scan())
  			;
  		return (char) c;
  	}
  
  	int nextInt() throws IOException {
  		int c, val = 0;
  		for (c = scan(); c <= 32; c = scan())
  			;
  		boolean neg = c == '-';
  		if (c == '-' || c == '+') {
  			c = scan();
  		}
  		for (; c >= '0' && c <= '9'; c = scan()) {
  			val = (val << 3) + (val << 1) + (c & 15);
  		}
  		return neg ? -val : val;
  	}
  
  	long nextLong() throws IOException {
  		int c;
  		long val = 0;
  		for (c = scan(); c <= 32; c = scan())
  			;
  		boolean neg = c == '-';
  		if (c == '-' || c == '+') {
  			c = scan();
  		}
  		for (; c >= '0' && c <= '9'; c = scan()) {
  			val = (val << 3) + (val << 1) + (c & 15);
  		}
  		return neg ? -val : val;
  	}
  }