2516 - 电梯

Input

Output

Examples

Input

1
1 396
512 619 633

Output

526
Time Limit 1 second
Memory Limit 128 MB
Discuss Stats
上一题 下一题