import math, sequtils, strutils let t = parseInt readLine stdin nms = t.newSeqWith stdin.readLine.split.map parseInt for nm in nms: let n = nm[0] m = nm[1] sum = n + m v1 = n.ceilDiv 4 v2 = sum.ceilDiv 8 echo max(v1, v2)