doInstruction s (RotateRBase c) = doInstruction s (RotateR rotateTimes)
  where
    ci = fromJust $ elemIndex c s
    rotateTimes
      | ci >= 4 = 2 + ci
      | otherwise = 1 + ci
doInstruction s (RotateRBase c) = doInstruction s (RotateR rotateTimes)
  where
    ci = fromJust $ elemIndex c s
    rotateTimes
      | ci >= 4 = 2 + ci
      | otherwise = 1 + ci
doInstruction s (RotateRBase c) = doInstruction s (RotateR rotateTimes)
  where
    ci = fromJust $ elemIndex c s
    rotateTimes
      | ci >= 4 = 2 + ci
      | otherwise = 1 + ci