let content = '';
process.stdin.resume();
process.stdin.setEncoding('utf8');
process.stdin.on('data', buf => {
  content += buf;
});

process.stdin.on('end', () => {
  let [size, ...lines] = content.trim().split('\n');
  const [matA, matB] = lines.map(line =>
    line.split(' ').map(n => parseInt(n, 10))
  );

  for (let i = 1; i <= 3; i++) {
    console.log(getDistance(matA, matB, i));
  }
  console.log(getDistance(matA, matB, Infinity));
});

const getDistance = (matA, matB, p) => {
  if (p === Infinity) {
    return Math.max(...matA.map((num, i) => Math.abs(num - matB[i])));
  } else {
    const sum = matA.reduce((prev, cur, i) => prev + Math.pow(Math.abs(cur - matB[i]), p), 0);
    return Math.pow(sum, 1 / p);
  }
};
