from bisect import bisect_left as bl

INF = 10 ** 20



def main():

  

  w, h = list(map(int, input().split()))

  n = int(eval(input()))

  

  xlst = []

  ylst = []

  appx = xlst.append

  appy = ylst.append

  for i in range(n):

    x, y = list(map(int,input().split()))

    appx(x)

    appy(y)

  

  sorted_xlst = sorted(xlst)

  sorted_ylst = sorted(ylst)

  accx = accy = 0

  cum_sum_xlst = []

  cum_sum_ylst = []

  appx = cum_sum_xlst.append

  appy = cum_sum_ylst.append



  for i in range(n):

    accx += sorted_xlst[i]

    accy += sorted_ylst[i]

    appx(accx)

    appy(accy)

  

  if n % 2:

    clx = crx = sorted_xlst[n // 2]

    cly = cry = sorted_ylst[n // 2]

  else:

    clx = sorted_xlst[n // 2 - 1]

    crx = sorted_xlst[n // 2]

    cly = sorted_ylst[n // 2 - 1]

    cry = sorted_ylst[n // 2]

  

  ans = ansx = ansy = INF

  

  for i in range(n):

    xi = xlst[i]

    yi = ylst[i]



    if xi <= clx:

      cx = crx

    else:

      cx = clx



    if yi <= cly:

      cy = cry

    else:

      cy = cly

  

    px = bl(sorted_xlst, cx)

    py = bl(sorted_ylst, cy)



    dx = xi - cx

    if dx < 0:

      dx = -dx



    if px:

      csx = cum_sum_xlst[px - 1]

      xlen = (accx - csx * 2 - cx * (n - px * 2)) * 2 - dx

    else:

      xlen = (accx - cx * n) * 2 - dx

 

    dy = yi - cy

    if dy < 0:

      dy = -dy

   

    if py:

      csy = cum_sum_ylst[py - 1]

      ylen = (accy - csy * 2 - cy * (n - py * 2)) * 2 - dy

    else:

      ylen = (accy - cy * n) * 2 - dy

    

    tlen = xlen + ylen



    if ans > tlen:

      ans = tlen

      ansx = cx

      ansy = cy

    elif ans == tlen:

      if ansx > cx:

        ansx = cx

        ansy = cy

      elif ansx == cx:

        if ansy > cy:

          ansy = cy 

  

  print(ans)

  print((ansx, ansy))



main()

from bisect import bisect_left as bl

INF = 10 ** 20



def main():

  

  w, h = list(map(int, input().split()))

  n = int(eval(input()))

  

  xlst = []

  ylst = []

  appx = xlst.append

  appy = ylst.append

  for i in range(n):

    x, y = list(map(int,input().split()))

    appx(x)

    appy(y)

  

  sorted_xlst = sorted(xlst)

  sorted_ylst = sorted(ylst)

  accx = accy = 0

  cum_sum_xlst = []

  cum_sum_ylst = []

  appx = cum_sum_xlst.append

  appy = cum_sum_ylst.append



  for i in range(n):

    accx += sorted_xlst[i]

    accy += sorted_ylst[i]

    appx(accx)

    appy(accy)

  

  if n % 2:

    clx = crx = sorted_xlst[n // 2]

    cly = cry = sorted_ylst[n // 2]

  else:

    clx = sorted_xlst[n // 2 - 1]

    crx = sorted_xlst[n // 2]

    cly = sorted_ylst[n // 2 - 1]

    cry = sorted_ylst[n // 2]

  plx = bl(sorted_xlst, clx)

  prx = bl(sorted_xlst, crx)

  ply = bl(sorted_ylst, cly)

  pry = bl(sorted_ylst, cry)





  

  ans = ansx = ansy = INF

  

  for i in range(n):

    xi = xlst[i]

    yi = ylst[i]



    if xi <= clx:

      cx = crx

      px = prx

    else:

      cx = clx

      px = plx

    if yi <= cly:

      cy = cry

      py = pry

    else:

      cy = cly

      py = ply

  

    dx = xi - cx

    if dx < 0:

      dx = -dx



    if px:

      csx = cum_sum_xlst[px - 1]

      xlen = (accx - csx * 2 - cx * (n - px * 2)) * 2 - dx

    else:

      xlen = (accx - cx * n) * 2 - dx

 

    dy = yi - cy

    if dy < 0:

      dy = -dy

   

    if py:

      csy = cum_sum_ylst[py - 1]

      ylen = (accy - csy * 2 - cy * (n - py * 2)) * 2 - dy

    else:

      ylen = (accy - cy * n) * 2 - dy

    

    tlen = xlen + ylen



    if ans > tlen:

      ans = tlen

      ansx = cx

      ansy = cy

    elif ans == tlen:

      if ansx > cx:

        ansx = cx

        ansy = cy

      elif ansx == cx:

        if ansy > cy:

          ansy = cy 

  

  print(ans)

  print((ansx, ansy))



main()

from bisect import bisect_left as bl

INF = 10**20


def main():
    w, h = list(map(int, input().split()))
    n = int(eval(input()))
    xlst = []
    ylst = []
    appx = xlst.append
    appy = ylst.append
    for i in range(n):
        x, y = list(map(int, input().split()))
        appx(x)
        appy(y)
    sorted_xlst = sorted(xlst)
    sorted_ylst = sorted(ylst)
    accx = accy = 0
    cum_sum_xlst = []
    cum_sum_ylst = []
    appx = cum_sum_xlst.append
    appy = cum_sum_ylst.append
    for i in range(n):
        accx += sorted_xlst[i]
        accy += sorted_ylst[i]
        appx(accx)
        appy(accy)
    if n % 2:
        clx = crx = sorted_xlst[n // 2]
        cly = cry = sorted_ylst[n // 2]
    else:
        clx = sorted_xlst[n // 2 - 1]
        crx = sorted_xlst[n // 2]
        cly = sorted_ylst[n // 2 - 1]
        cry = sorted_ylst[n // 2]
    ans = ansx = ansy = INF
    for i in range(n):
        xi = xlst[i]
        yi = ylst[i]
        if xi <= clx:
            cx = crx
        else:
            cx = clx
        if yi <= cly:
            cy = cry
        else:
            cy = cly
        px = bl(sorted_xlst, cx)
        py = bl(sorted_ylst, cy)
        dx = xi - cx
        if dx < 0:
            dx = -dx
        if px:
            csx = cum_sum_xlst[px - 1]
            xlen = (accx - csx * 2 - cx * (n - px * 2)) * 2 - dx
        else:
            xlen = (accx - cx * n) * 2 - dx
        dy = yi - cy
        if dy < 0:
            dy = -dy
        if py:
            csy = cum_sum_ylst[py - 1]
            ylen = (accy - csy * 2 - cy * (n - py * 2)) * 2 - dy
        else:
            ylen = (accy - cy * n) * 2 - dy
        tlen = xlen + ylen
        if ans > tlen:
            ans = tlen
            ansx = cx
            ansy = cy
        elif ans == tlen:
            if ansx > cx:
                ansx = cx
                ansy = cy
            elif ansx == cx:
                if ansy > cy:
                    ansy = cy
    print(ans)
    print((ansx, ansy))


main()

from bisect import bisect_left as bl

INF = 10**20


def main():
    w, h = list(map(int, input().split()))
    n = int(eval(input()))
    xlst = []
    ylst = []
    appx = xlst.append
    appy = ylst.append
    for i in range(n):
        x, y = list(map(int, input().split()))
        appx(x)
        appy(y)
    sorted_xlst = sorted(xlst)
    sorted_ylst = sorted(ylst)
    accx = accy = 0
    cum_sum_xlst = []
    cum_sum_ylst = []
    appx = cum_sum_xlst.append
    appy = cum_sum_ylst.append
    for i in range(n):
        accx += sorted_xlst[i]
        accy += sorted_ylst[i]
        appx(accx)
        appy(accy)
    if n % 2:
        clx = crx = sorted_xlst[n // 2]
        cly = cry = sorted_ylst[n // 2]
    else:
        clx = sorted_xlst[n // 2 - 1]
        crx = sorted_xlst[n // 2]
        cly = sorted_ylst[n // 2 - 1]
        cry = sorted_ylst[n // 2]
    plx = bl(sorted_xlst, clx)
    prx = bl(sorted_xlst, crx)
    ply = bl(sorted_ylst, cly)
    pry = bl(sorted_ylst, cry)
    ans = ansx = ansy = INF
    for i in range(n):
        xi = xlst[i]
        yi = ylst[i]
        if xi <= clx:
            cx = crx
            px = prx
        else:
            cx = clx
            px = plx
        if yi <= cly:
            cy = cry
            py = pry
        else:
            cy = cly
            py = ply
        dx = xi - cx
        if dx < 0:
            dx = -dx
        if px:
            csx = cum_sum_xlst[px - 1]
            xlen = (accx - csx * 2 - cx * (n - px * 2)) * 2 - dx
        else:
            xlen = (accx - cx * n) * 2 - dx
        dy = yi - cy
        if dy < 0:
            dy = -dy
        if py:
            csy = cum_sum_ylst[py - 1]
            ylen = (accy - csy * 2 - cy * (n - py * 2)) * 2 - dy
        else:
            ylen = (accy - cy * n) * 2 - dy
        tlen = xlen + ylen
        if ans > tlen:
            ans = tlen
            ansx = cx
            ansy = cy
        elif ans == tlen:
            if ansx > cx:
                ansx = cx
                ansy = cy
            elif ansx == cx:
                if ansy > cy:
                    ansy = cy
    print(ans)
    print((ansx, ansy))


main()

+    plx = bl(sorted_xlst, clx) +    prx = bl(sorted_xlst, crx) +    ply = bl(sorted_ylst, cly) +    pry = bl(sorted_ylst, cry) +            px = prx +            px = plx +            py = pry -        px = bl(sorted_xlst, cx) -        py = bl(sorted_ylst, cy) +            py = ply