def trunc_divmod(a, b): q = a / b q = -int(-q) if q<0 else int(q) r = a - b * q return q, r