Air Cownditioning

아직 제출이 없습니다시간 제한2초메모리 제한1024 MB

문제

Farmer John's cows NN are very particular about the room temperature in their barn. Some cows like the temperature to be on the cooler side, while others prefer more warmth.

Farmer John's barn contains a sequence of NN stalls, numbered 1N1 \ldots N, each containing a single cow. The ii-th cow prefers the temperature of her stall to be p_ip\_i, and right now the temperature in her stall is t_it\_i. In order to make sure every cow is comfortable, Farmer John installs a new air conditioning system that is controlled in a somewhat interesting way. He can send commands to the system telling it to either raise or lower the temperature in a consecutive series of stalls by 1 unit --- for example "raise the temperature in stalls 585 \ldots 8 by 1 unit". The series of stalls could be as short as just a single stall.

Please help Farmer John determine the minimum number of commands he needs to send his new air conditioning system so that every cow's stall is at the ideal temperature for its resident cow.

입력

The first line of input contains NN. The next line contains the NN non-negative integers p_1p_Np\_1 \ldots p\_N, separated by spaces. The final line contains the NN non-negative integers t_1t_Nt\_1 \ldots t\_N.

출력

Please write a single integer as output containing the minimum number of commands Farmer John needs to use.

제한

  • N100,000N \leq 100,000
  • Temperature values are at most 10,00010,000.