int RussianMul(int n, int m){ int remain = 0; while(n != 1) { // odd if (n % 2 != 0) { n = (n-1)/2; remain += m; m *= 2; } // even else { n /= 2; m *= 2; } } return m + remain;}