if x < 10 or y < 10
                            return xy
                        d = ⌊ max(length(p), length(q)) / 2 ⌋
                        xhigh, xlow = split x as a string at d
                        yhigh, ylow = split y as a string at d
                        a = karatsuba(xhigh, yhigh)
                        b = karatsuba(xhigh + xlow, yhigh + ylow)
                        c = karatsuba(xlow, ylow)
                        result = c*102d + (b-c-a)*10d + a
                        return result