repeatedParallelCubic ecs points times modulus
    | rem == 0  = square
    | otherwise = squarePlus1
    where (half, rem) = divMod times 2
          result      = repeatedParallelCubic ecs points half modulus
          square      = case result of
                          Left ps -> parallelCubicLaw ecs ps ps modulus
                          Right div -> Right div
          squarePlus1 = case square of
                          Left ps -> parallelCubicLaw ecs points ps modulus
                          Right div -> Right div
repeatedParallelCubic ecs points times modulus
    | rem == 0  = square
    | otherwise = squarePlus1
    where (half, rem) = divMod times 2
          result      = repeatedParallelCubic ecs points half modulus
          square      = case result of
                          Left ps -> parallelCubicLaw ecs ps ps modulus
                          Right div -> Right div
          squarePlus1 = case square of
                          Left ps -> parallelCubicLaw ecs points ps modulus
                          Right div -> Right div
repeatedParallelCubic ecs points times modulus
    | rem == 0  = square
    | otherwise = squarePlus1
    where (half, rem) = divMod times 2
          result      = repeatedParallelCubic ecs points half modulus
          square      = case result of
                          Left ps -> parallelCubicLaw ecs ps ps modulus
                          Right div -> Right div
          squarePlus1 = case square of
                          Left ps -> parallelCubicLaw ecs points ps modulus
                          Right div -> Right div