There are n drivers and k batteries (k>=n) .They lie on x axis such that no two Drivers and No two batteries lie at same Point. A battery and A Driver may lie at the same point.There is also a Pickup Location “p”.

Each driver needs to take a Battery and go to the pickup location. A battery once taken cannot be used by other Driver.Assume drivers move unit distance per second. If two drivers reach a Battery at the same Time then only one person can Take it.A driver can pass through battery without taking it.

You need to Determine the minimum time needed for all n drivers to go to the pickup location after taking the battery.

Input:

n,k ,p,array a[i] containing n locations of driver and array b[i] containing k locations of battery

n<=1000

n<=k<=2000

1<=a[i],b[i],p<=1e9

Note: no two drivers or battery is at same point but a driver and a battery can be at the same point.

Can somebody help with this task? ,if anything is unclear feel free to ask in comments