output_description: Print Q lines. The i-th line should contain the answer to the i-th query.
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      A B Q
      s_1
      :
      s_A
      t_1
      :
      t_B
      x_1
      :
      x_Q
attempt: # お約束
  INF = float("inf")
  MOD = int(1e9 + 7)
  
  
  def int1(n):
      return int(n) - 1
  
  
  def parse(args, *params):
      return tuple(p(v) for p, v in zip(params, next(args).split()))
  
  
  # 二分探索
  def bsr(a, v, lo=0, hi=None):
      if hi == None:
          hi = len(a) - 1
      if hi < lo:
          return lo
      mi = (lo + hi) // 2
      if v < a[mi]:
          return bsr(a, v, lo, mi - 1)
      else:
          return bsr(a, v, mi + 1, hi)
  
  
  # エントリーポイント
  def main(args):
      A, B, Q = parse(args, int, int, int)
      S = list(int(next(args)) for _ in range(A))
      T = list(int(next(args)) for _ in range(B))
      X = tuple(int(next(args)) for _ in range(Q))
  
      s = [-INF] + S + [INF]
      t = [-INF] + T + [INF]
      for x in X:
          sr = bsr(s, x)
          sl = sr - 1
          tr = bsr(t, x)
          tl = tr - 1
          min_cost = INF
          for st in [s[sl], s[sr]]:
              for tt in [t[tl], t[tr]]:
                  min_cost = min(min_cost, abs(st - x) + abs(tt - st))
                  min_cost = min(min_cost, abs(tt - x) + abs(tt - st))
          print(min_cost)
  
  
  import sys
  
  if __name__ == "__main__":
      main(iter(sys.stdin.read().split("\n")))
  
problem_description: Statement
  
  Along a road running in an east-west direction, there are A shrines and B
  temples. The i-th shrine from the west is located at a distance of s_i meters
  from the west end of the road, and the i-th temple from the west is located at
  a distance of t_i meters from the west end of the road.
  
  Answer the following Q queries:
  
    * Query i (1 \leq i \leq Q): If we start from a point at a distance of x_i meters from the west end of the road and freely travel along the road, what is the minimum distance that needs to be traveled in order to visit one shrine and one temple? (It is allowed to pass by more shrines and temples than required.)
samples: [{"input": "2 3 4\n    100\n    600\n    400\n    900\n    1000\n    150\n    2000\n    899\n    799", "output": "350\n    1400\n    301\n    399\n    \n\nThere are two shrines and three temples. The shrines are located at distances\nof 100, 600 meters from the west end of the road, and the temples are located\nat distances of 400, 900, 1000 meters from the west end of the road.\n\n  * Query 1: If we start from a point at a distance of 150 meters from the west end of the road, the optimal move is first to walk 50 meters west to visit a shrine, then to walk 300 meters east to visit a temple.\n  * Query 2: If we start from a point at a distance of 2000 meters from the west end of the road, the optimal move is first to walk 1000 meters west to visit a temple, then to walk 400 meters west to visit a shrine. We will pass by another temple on the way, but it is fine.\n  * Query 3: If we start from a point at a distance of 899 meters from the west end of the road, the optimal move is first to walk 1 meter east to visit a temple, then to walk 300 meters west to visit a shrine.\n  * Query 4: If we start from a point at a distance of 799 meters from the west end of the road, the optimal move is first to walk 199 meters west to visit a shrine, then to walk 200 meters west to visit a temple.\n\n* * *"}, {"input": "1 1 3\n    1\n    10000000000\n    2\n    9999999999\n    5000000000", "output": "10000000000\n    10000000000\n    14999999998\n    \n\nThe road is quite long, and we may need to travel a distance that does not fit\ninto a 32-bit integer."}]