Submit solution

Points: 100
Time limit: 1.0s
Memory limit: 256M

Author:
Problem type

I-Will-Windra has entered a racing contest! The racetrack can be represented as two arrays of integers a and b, both of length n. When I-Will-Windra is at position i, they can jump a[i] positions to the left or right, assuming it is within the bounds of the array. Furthermore, this move costs them b[i].

As I-Will-Windra's FIT2004 tutor, you want to help them. Given starting positions x and y, what is the minimum cost by which I-Will-Windra can get from x to y? If this is not possible, output -1 instead.

Input

The first line of input will consist of three integers, x y and z.

The next two lines will each consist of n integers, representing a and b respectively.

Output

The output should consist of a single integer, the minimum cost or -1 if it is impossible.

Constraints

  • 2 \le n \le 10^5
  • 0 \le x,y \le n-1
  • 1 \le a[i] \le n
  • 1 \le b[i] \le 30

Example 1

Input
5 4 2
3 3 1 3 2
533 776 812 489 523
Output
523
Explanation

This can be completed in one jump, from index 4 to index 2 (of cost 523).


Comments

There are no comments at the moment.