Restorer Distance

medium
<a href="https://codeforces.com/contest/1355/problem/E" target="_blank"><i class="fa fa-external-link" aria-hidden="true"> Link -> Restorer Distance</i></a>

Input Format

Check the Link

Output Format

Check the Link

Constraints

Check the Link

Example

Input
3 1 100 100
1 3 8
Output
12
Previous
Closest Distance
Next
Trick Or Treat

Related Questions