问题 C: Bansho Tan'in

文件提交:无需freopen 内存限制:1024 MB 时间限制:2.000 S
评测方式:普通裁判 命题人:
提交:5 解决:5

题目描述

Bansho Tan'in (万象天引) is a powerful skill used by a character in Narumooo, Bessie's favorite anime. The skill allows the caster to obtain an object within a certain range to their hand, centering on the caster. After rigorous training, Bessie finally mastered this skill. Unfortunately, she is not very proficient yet and can only use the skill N times in total, with the effective range of the skill being unstable and represented by $L_i$ for the i-th use.

In other words, if Bessie stands at position p, during the i-th use of the skill, she can obtain an object located within the range $[p-L_i , p+L_i]$, provided that the object has not already been collected.

During a casual conversation, Bessie inadvertently learned that Farmer John hid his N treasures along a number line, with the i-th treasure located at position $X_i$. The task is to determine how many different positions p on the number line would allow Bessie to stand there and collect all of Farmer John's treasures using the skill exactly N times.

输入

The input is given from Standard Input in the following format:

$N$

$X_1 \qquad X_2 \qquad ... \qquad X_N$

$L_1 \qquad L_2 \qquad ... \qquad L_N$

输出

Print the number of integers kp that satisfy the condition in the statement.

样例输入

3
-6 0 7
3 5 10

样例输出

6

提示

For the sample output, 

 satisfy the condition. For example, when k=3, Bessie can grab all three treasures as follows.

  • The first move can grab treasures at coordinates x satisfying 6x0. Among them, grab the first treasure at coordinate 6.
  • The second move can grab treasures at coordinates x satisfying 8x2. Among them, grab the second treasure at coordinate 0.
  • The third move can grab treasures at coordinates x satisfying 13x7. Among them, grab the third treasure at coordinate 7.


Constraints


  • $1\le N \le 200$
  • $-10^{18} \le X_1 < X_2 < ... <X_N \le 10^{18} $
  • $1 \le L_1 \le L_2 \le ... \le L_N \le 10^{18}$