using System;
using System.Globalization;
public class Program
{
public static void Main()
Console.WriteLine(Rotate(30, 10));
}
private static int Rotate(int n, int m)
if (n <= m)
return n;
var auxM = 0;
for (var i = 1; i <= n; i++)
if (auxM == m)
auxM = 0;
else
auxM++;
return auxM;