console.log(
  require('fs')
    .readFileSync('/dev/stdin', 'utf8')
    .split('\n')
    .slice(1)
    .map(l => l.split(' ').map(s => parseInt(s)))
    .reduce((v, c) => v.map((e, i) => Math.max(e - c[i], 0)))
    .reduce((s, c) => s + c)
);
