handles simple cases with 1 a and 1 b