// Arup Guha
// 4/10/2017
// Solution to 1992 UCF HS Contest Problem: Hexagons

import java.util.*;

public class hexagons {

	public static void main(String[] args) {

		Scanner stdin = new Scanner(System.in);

		// Process each case
		while (stdin.hasNext()) {

			// Get x,y coordinates of starting and ending locations.
			String strStart = stdin.next();
			String strEnd = stdin.next();
			int[] start = convert(strStart);
			int[] end = convert(strEnd);

			// Places start to the left of end.
			if (start[0] > end[0]) {
				int[] tmp = start;
				start = end;
				end = tmp;
			}

			// Output result
			System.out.println("The distance from "+strStart+" to "+strEnd+" is "+solve(start, end)+".");
		}
	}

	// Converts the input format string into an ordered pair (column, row) and returns that.
	public static int[] convert(String s) {
		int[] res = new int[2];
		res[0] = Integer.parseInt(s.substring(0,2));
		res[1] = Integer.parseInt(s.substring(2));
		return res;
	}

	// Solves a query.
	public static int solve(int[] start, int[] end) {

		// The bounds of where I can reach on column end[0] - these are valid for even starting columns.
		int minY = start[1] + (start[0]-end[0])/2;
		int maxY = start[1] + (end[0]-start[0]+1)/2;

		// These are the corresponding bounds for odd starting columns.
		if (start[0]%2 == 1) {
			minY = start[1] + (start[0]-end[0]-1)/2;
			maxY = start[1] + (end[0]-start[0])/2;
		}

		// In bounds, we can make it to this point going straight across.
		if (end[1] >= minY && end[1] <= maxY) return end[0] - start[0];

		// Need to "go down" after we get to maxY.
		if (end[1] > maxY) return end[0] - start[0] + end[1] - maxY;

		// Need to go up after get to minY;
		return end[0] - start[0] + minY - end[1];
	}
}