import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner reader = new Scanner(System.in);
		String strA = reader.next();
		int[] A = new int[5];
		String strB = reader.next();
		int[] B = new int[5];
		for (int i = 0; i < 5; i++) {
			A[i] = Character.getNumericValue(strA.charAt(i));
			B[i] = Character.getNumericValue(strB.charAt(i));
		}
		int ans = 0;
		int[] C = new int[5];
		C[0] = B[0] - A[0];
		if (C[0] == 0) {
			C[1] = B[1] - A[1]  - 1;
		} else {
			C[1] = 10;
		}
		if (C[1] == 0) {
			C[2] = B[2] - A[2]  - 1;
		} else {
			C[2] = 10;
		}
		ans = C[0] * C[1] * C[2];
		int intA = Integer.parseInt(strA);

		int below = 0;
		for (int i = A[0]*10000; i < intA; i++) {
			int n1 = i/10000;
			int n2 = i%10000/1000;
			int n4 = i%100/10;
			int n5 = i%10;
			if (n1 == n5 && n2 == n4) {
				below++;
			}
		}

		int intB = Integer.parseInt(strB);
		int above = 0;
		for (int i = B[0]*10000; i <= intB; i++) {
			int n1 = i/10000;
			int n2 = i%10000/1000;
			int n4 = i%100/10;
			int n5 = i%10;
			if (n1 == n5 && n2 == n4) {
				above++;
			}
		}

		System.out.println(ans - below + above);
		reader.close();
	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		Scanner reader = new Scanner(System.in);
		String strA = reader.next();
		int[] A = new int[5];
		String strB = reader.next();
		int[] B = new int[5];
		for (int i = 0; i < 5; i++) {
			A[i] = Character.getNumericValue(strA.charAt(i));
			B[i] = Character.getNumericValue(strB.charAt(i));
		}
		int ans = 0;
		int[] C = new int[5];
		C[0] = B[0] - A[0];
		if (C[0] == 0) {
			C[1] = B[1] - A[1]  - 1;
		} else {
			C[1] = 10;
		}
		if (C[1] == 0) {
			C[2] = B[2] - A[2]  - 1;
		} else {
			C[2] = 10;
		}
		ans = C[0] * C[1] * C[2];
		int intA = Integer.parseInt(strA);

		int below = 0;
		for (int i = A[0]*10000; i < intA; i++) {
			int n1 = i/10000;
			int n2 = i%10000/1000;
			int n4 = i%100/10;
			int n5 = i%10;
			if (n1 == n5 && n2 == n4) {
				below++;
			}
		}

		int intB = Integer.parseInt(strB);
		int above = 0;
		for (int i = B[0]*10000; i <= intB; i++) {
			int n1 = i/10000;
			int n2 = i%10000/1000;
			int n4 = i%100/10;
			int n5 = i%10;
			if (n1 == n5 && n2 == n4) {
				above++;
			}
		}

		System.out.println(ans - below + above);
		reader.close();
	}
} Main public static void main(String[] args) {
		Scanner reader = new Scanner(System.in);
		String strA = reader.next();
		int[] A = new int[5];
		String strB = reader.next();
		int[] B = new int[5];
		for (int i = 0; i < 5; i++) {
			A[i] = Character.getNumericValue(strA.charAt(i));
			B[i] = Character.getNumericValue(strB.charAt(i));
		}
		int ans = 0;
		int[] C = new int[5];
		C[0] = B[0] - A[0];
		if (C[0] == 0) {
			C[1] = B[1] - A[1]  - 1;
		} else {
			C[1] = 10;
		}
		if (C[1] == 0) {
			C[2] = B[2] - A[2]  - 1;
		} else {
			C[2] = 10;
		}
		ans = C[0] * C[1] * C[2];
		int intA = Integer.parseInt(strA);

		int below = 0;
		for (int i = A[0]*10000; i < intA; i++) {
			int n1 = i/10000;
			int n2 = i%10000/1000;
			int n4 = i%100/10;
			int n5 = i%10;
			if (n1 == n5 && n2 == n4) {
				below++;
			}
		}

		int intB = Integer.parseInt(strB);
		int above = 0;
		for (int i = B[0]*10000; i <= intB; i++) {
			int n1 = i/10000;
			int n2 = i%10000/1000;
			int n4 = i%100/10;
			int n5 = i%10;
			if (n1 == n5 && n2 == n4) {
				above++;
			}
		}

		System.out.println(ans - below + above);
		reader.close();
	} main {
		Scanner reader = new Scanner(System.in);
		String strA = reader.next();
		int[] A = new int[5];
		String strB = reader.next();
		int[] B = new int[5];
		for (int i = 0; i < 5; i++) {
			A[i] = Character.getNumericValue(strA.charAt(i));
			B[i] = Character.getNumericValue(strB.charAt(i));
		}
		int ans = 0;
		int[] C = new int[5];
		C[0] = B[0] - A[0];
		if (C[0] == 0) {
			C[1] = B[1] - A[1]  - 1;
		} else {
			C[1] = 10;
		}
		if (C[1] == 0) {
			C[2] = B[2] - A[2]  - 1;
		} else {
			C[2] = 10;
		}
		ans = C[0] * C[1] * C[2];
		int intA = Integer.parseInt(strA);

		int below = 0;
		for (int i = A[0]*10000; i < intA; i++) {
			int n1 = i/10000;
			int n2 = i%10000/1000;
			int n4 = i%100/10;
			int n5 = i%10;
			if (n1 == n5 && n2 == n4) {
				below++;
			}
		}

		int intB = Integer.parseInt(strB);
		int above = 0;
		for (int i = B[0]*10000; i <= intB; i++) {
			int n1 = i/10000;
			int n2 = i%10000/1000;
			int n4 = i%100/10;
			int n5 = i%10;
			if (n1 == n5 && n2 == n4) {
				above++;
			}
		}

		System.out.println(ans - below + above);
		reader.close();
	} Scanner reader = new Scanner(System.in); reader new Scanner(System.in) String strA = reader.next(); strA reader.next() reader.next reader int[] A = new int[5]; A new int[5] 5 String strB = reader.next(); strB reader.next() reader.next reader int[] B = new int[5]; B new int[5] 5 for (int i = 0; i < 5; i++) {
			A[i] = Character.getNumericValue(strA.charAt(i));
			B[i] = Character.getNumericValue(strB.charAt(i));
		} int i = 0; int i = 0; i 0 i < 5 i 5 i++ i++ i {
			A[i] = Character.getNumericValue(strA.charAt(i));
			B[i] = Character.getNumericValue(strB.charAt(i));
		} {
			A[i] = Character.getNumericValue(strA.charAt(i));
			B[i] = Character.getNumericValue(strB.charAt(i));
		} A[i] = Character.getNumericValue(strA.charAt(i)) A[i] A i Character.getNumericValue(strA.charAt(i)) Character.getNumericValue Character strA.charAt(i) strA.charAt strA i B[i] = Character.getNumericValue(strB.charAt(i)) B[i] B i Character.getNumericValue(strB.charAt(i)) Character.getNumericValue Character strB.charAt(i) strB.charAt strB i int ans = 0; ans 0 int[] C = new int[5]; C new int[5] 5 C[0] = B[0] - A[0] C[0] C 0 B[0] - A[0] B[0] B 0 A[0] A 0 if (C[0] == 0) {
			C[1] = B[1] - A[1]  - 1;
		} else {
			C[1] = 10;
		} C[0] == 0 C[0] C 0 0 {
			C[1] = B[1] - A[1]  - 1;
		} C[1] = B[1] - A[1]  - 1 C[1] C 1 B[1] - A[1]  - 1 B[1] - A[1]  - 1 B[1] B 1 A[1] A 1 1 {
			C[1] = 10;
		} C[1] = 10 C[1] C 1 10 if (C[1] == 0) {
			C[2] = B[2] - A[2]  - 1;
		} else {
			C[2] = 10;
		} C[1] == 0 C[1] C 1 0 {
			C[2] = B[2] - A[2]  - 1;
		} C[2] = B[2] - A[2]  - 1 C[2] C 2 B[2] - A[2]  - 1 B[2] - A[2]  - 1 B[2] B 2 A[2] A 2 1 {
			C[2] = 10;
		} C[2] = 10 C[2] C 2 10 ans = C[0] * C[1] * C[2] ans C[0] * C[1] * C[2] C[0] * C[1] * C[2] C[0] C 0 C[1] C 1 C[2] C 2 int intA = Integer.parseInt(strA); intA Integer.parseInt(strA) Integer.parseInt Integer strA int below = 0; below 0 for (int i = A[0]*10000; i < intA; i++) {
			int n1 = i/10000;
			int n2 = i%10000/1000;
			int n4 = i%100/10;
			int n5 = i%10;
			if (n1 == n5 && n2 == n4) {
				below++;
			}
		} int i = A[0]*10000; int i = A[0]*10000; i A[0]*10000 A[0] A 0 10000 i < intA i intA i++ i++ i {
			int n1 = i/10000;
			int n2 = i%10000/1000;
			int n4 = i%100/10;
			int n5 = i%10;
			if (n1 == n5 && n2 == n4) {
				below++;
			}
		} {
			int n1 = i/10000;
			int n2 = i%10000/1000;
			int n4 = i%100/10;
			int n5 = i%10;
			if (n1 == n5 && n2 == n4) {
				below++;
			}
		} int n1 = i/10000; n1 i/10000 i 10000 int n2 = i%10000/1000; n2 i%10000/1000 i%10000 i 10000 1000 int n4 = i%100/10; n4 i%100/10 i%100 i 100 10 int n5 = i%10; n5 i%10 i 10 if (n1 == n5 && n2 == n4) {
				below++;
			} n1 == n5 && n2 == n4 n1 == n5 n1 n5 n2 == n4 n2 n4 {
				below++;
			} below++ below int intB = Integer.parseInt(strB); intB Integer.parseInt(strB) Integer.parseInt Integer strB int above = 0; above 0 for (int i = B[0]*10000; i <= intB; i++) {
			int n1 = i/10000;
			int n2 = i%10000/1000;
			int n4 = i%100/10;
			int n5 = i%10;
			if (n1 == n5 && n2 == n4) {
				above++;
			}
		} int i = B[0]*10000; int i = B[0]*10000; i B[0]*10000 B[0] B 0 10000 i <= intB i intB i++ i++ i {
			int n1 = i/10000;
			int n2 = i%10000/1000;
			int n4 = i%100/10;
			int n5 = i%10;
			if (n1 == n5 && n2 == n4) {
				above++;
			}
		} {
			int n1 = i/10000;
			int n2 = i%10000/1000;
			int n4 = i%100/10;
			int n5 = i%10;
			if (n1 == n5 && n2 == n4) {
				above++;
			}
		} int n1 = i/10000; n1 i/10000 i 10000 int n2 = i%10000/1000; n2 i%10000/1000 i%10000 i 10000 1000 int n4 = i%100/10; n4 i%100/10 i%100 i 100 10 int n5 = i%10; n5 i%10 i 10 if (n1 == n5 && n2 == n4) {
				above++;
			} n1 == n5 && n2 == n4 n1 == n5 n1 n5 n2 == n4 n2 n4 {
				above++;
			} above++ above System.out.println(ans - below + above) System.out.println System.out System System.out ans - below + above ans - below ans below above reader.close() reader.close reader String[] args args public class Main {
	public static void main(String[] args) {
		Scanner reader = new Scanner(System.in);
		String strA = reader.next();
		int[] A = new int[5];
		String strB = reader.next();
		int[] B = new int[5];
		for (int i = 0; i < 5; i++) {
			A[i] = Character.getNumericValue(strA.charAt(i));
			B[i] = Character.getNumericValue(strB.charAt(i));
		}
		int ans = 0;
		int[] C = new int[5];
		C[0] = B[0] - A[0];
		if (C[0] == 0) {
			C[1] = B[1] - A[1]  - 1;
		} else {
			C[1] = 10;
		}
		if (C[1] == 0) {
			C[2] = B[2] - A[2]  - 1;
		} else {
			C[2] = 10;
		}
		ans = C[0] * C[1] * C[2];
		int intA = Integer.parseInt(strA);

		int below = 0;
		for (int i = A[0]*10000; i < intA; i++) {
			int n1 = i/10000;
			int n2 = i%10000/1000;
			int n4 = i%100/10;
			int n5 = i%10;
			if (n1 == n5 && n2 == n4) {
				below++;
			}
		}

		int intB = Integer.parseInt(strB);
		int above = 0;
		for (int i = B[0]*10000; i <= intB; i++) {
			int n1 = i/10000;
			int n2 = i%10000/1000;
			int n4 = i%100/10;
			int n5 = i%10;
			if (n1 == n5 && n2 == n4) {
				above++;
			}
		}

		System.out.println(ans - below + above);
		reader.close();
	}
} public class Main {
	public static void main(String[] args) {
		Scanner reader = new Scanner(System.in);
		String strA = reader.next();
		int[] A = new int[5];
		String strB = reader.next();
		int[] B = new int[5];
		for (int i = 0; i < 5; i++) {
			A[i] = Character.getNumericValue(strA.charAt(i));
			B[i] = Character.getNumericValue(strB.charAt(i));
		}
		int ans = 0;
		int[] C = new int[5];
		C[0] = B[0] - A[0];
		if (C[0] == 0) {
			C[1] = B[1] - A[1]  - 1;
		} else {
			C[1] = 10;
		}
		if (C[1] == 0) {
			C[2] = B[2] - A[2]  - 1;
		} else {
			C[2] = 10;
		}
		ans = C[0] * C[1] * C[2];
		int intA = Integer.parseInt(strA);

		int below = 0;
		for (int i = A[0]*10000; i < intA; i++) {
			int n1 = i/10000;
			int n2 = i%10000/1000;
			int n4 = i%100/10;
			int n5 = i%10;
			if (n1 == n5 && n2 == n4) {
				below++;
			}
		}

		int intB = Integer.parseInt(strB);
		int above = 0;
		for (int i = B[0]*10000; i <= intB; i++) {
			int n1 = i/10000;
			int n2 = i%10000/1000;
			int n4 = i%100/10;
			int n5 = i%10;
			if (n1 == n5 && n2 == n4) {
				above++;
			}
		}

		System.out.println(ans - below + above);
		reader.close();
	}
} Main
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner reader = new Scanner(System.in);
		String strA = reader.next();
		int[] A = new int[5];
		String strB = reader.next();
		int[] B = new int[5];
		for (int i = 0; i < 5; i++) {
			A[i] = Character.getNumericValue(strA.charAt(i));
			B[i] = Character.getNumericValue(strB.charAt(i));
		}
		int ans = 0;
		int[] C = new int[5];
		C[0] = B[0] - A[0];
		if (C[0] == 0) {
			C[1] = B[1] - A[1]  - 1;
		} else {
			C[1] = 10;
		}
		if (C[1] == 0) {
			C[2] = B[2] - A[2]  - 1;
		} else {
			C[2] = 10;
		}
		ans = C[0] * C[1] * C[2];
		int intA = Integer.parseInt(strA);

		int below = 0;
		for (int i = A[0]*10000; i < intA; i++) {
			int n1 = i/10000;
			int n2 = i%10000/1000;
			int n4 = i%100/10;
			int n5 = i%10;
			if (n1 == n5 && n2 == n4) {
				below++;
			}
		}

		int intB = Integer.parseInt(strB);
		int above = 0;
		for (int i = B[0]*10000; i <= intB; i++) {
			int n1 = i/10000;
			int n2 = i%10000/1000;
			int n4 = i%100/10;
			int n5 = i%10;
			if (n1 == n5 && n2 == n4) {
				above++;
			}
		}

		System.out.println(ans - below + above);
		reader.close();
	}
}
