input = """(pad 0 smd rect (at 0 0) (size 5.5 5.5) (layers F.Cu F.Mask) (solder_mask_margin 0.07))
(pad 0 smd rect (at 1.4 -1.4) (size 2.5 2.5) (layers F.Paste) (solder_mask_margin 0.07))
(pad 0 smd rect (at -1.4 -1.4) (size 2.5 2.5) (layers F.Paste) (solder_mask_margin 0.07))
(pad 0 smd rect (at -1.4 1.4) (size 2.5 2.5) (layers F.Paste) (solder_mask_margin 0.07))
(pad 0 smd rect (at 1.4 1.4) (size 2.5 2.5) (layers F.Paste) (solder_mask_margin 0.07))"""

def get_xy_wh(l):
  seg= l.split(" ")
  return (float(seg[5]), float(seg[6][:-1]), float(seg[8]), float(seg[9][:-1]))
lines = [l for l in map(get_xy_wh, input.split("\n"))]
print(lines)

for (x, y, w, h) in lines:
  lx, ux, ly, uy = x - w/2, x + w/2, y - h/2, y + h/2
  print("""  (fp_poly (pts (xy {} {}) (xy {} {}) (xy {} {}) (xy {} {})) (layer F.Paste)  (width 0.1))""".format(
    lx, ly, lx, uy, ux, uy, ux, ly
    ))
