function movimientos() {
let input = readline();
let splited = input.split(',');
const x1 = Number(splited[0]);
const y1 = Number(splited[1]);
const x2 = Number(splited[2]);
const y2 = Number(splited[3]);
//console.log('inputs', splited);
if (x1 === x2 && y1 === y2) {
return 0;
}
const moves = [
[-2, -1], [-1, -2], [1, -2], [2, -1],
[2, 1], [1, 2], [-1, 2], [-2, 1]
];
const queue = [[x1, y1, 0]];
const marked = new Set([`${x1},${y1}`]);
while (queue.length > 0) {
const [x, y, jumps] = queue.shift();
for (const [dx, dy] of moves) {
const nx = x + dx;
const ny = y + dy;
if (nx === x2 && ny === y2) {
return jumps + 1;
}
const key = `${nx},${ny}`;
if (nx >= -200 && nx <= 200 && ny >= -200 && ny <= 200 && !marked.has(key)) {
marked.add(key);
queue.push([nx, ny, jumps + 1]);
}
}
}
return "IMPOSSIBLE";
}
console.log(movimientos());
ZnVuY3Rpb24gbW92aW1pZW50b3MoKSB7CiAgbGV0IGlucHV0ID0gcmVhZGxpbmUoKTsKICBsZXQgc3BsaXRlZCA9IGlucHV0LnNwbGl0KCcsJyk7CiAgY29uc3QgeDEgPSBOdW1iZXIoc3BsaXRlZFswXSk7CiAgY29uc3QgeTEgPSBOdW1iZXIoc3BsaXRlZFsxXSk7CiAgY29uc3QgeDIgPSBOdW1iZXIoc3BsaXRlZFsyXSk7CiAgY29uc3QgeTIgPSBOdW1iZXIoc3BsaXRlZFszXSk7CiAgLy9jb25zb2xlLmxvZygnaW5wdXRzJywgc3BsaXRlZCk7CiAgCiAgaWYgKHgxID09PSB4MiAmJiB5MSA9PT0geTIpIHsKICAgIHJldHVybiAwOwogIH0KCiAgY29uc3QgbW92ZXMgPSBbCiAgICBbLTIsIC0xXSwgWy0xLCAtMl0sIFsxLCAtMl0sIFsyLCAtMV0sIAogICAgWzIsIDFdLCBbMSwgMl0sIFstMSwgMl0sIFstMiwgMV0KICBdOwoKICBjb25zdCBxdWV1ZSA9IFtbeDEsIHkxLCAwXV07IAogIGNvbnN0IG1hcmtlZCA9IG5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