Approach hintTry it first, then revealHide
Moving clockwise from house cur to house t takes (t - cur + n) % n steps. Sum these over the tasks in order; the total can exceed 32 bits.
Moving clockwise from house cur to house t takes (t - cur + n) % n steps. Sum these over the tasks in order; the total can exceed 32 bits.