title: Multiply Large Integers Under Large Modulo
signature: multiply_large_integers_under_large_modulo <- function(a, b, mod_arg2) {
test_code: 
  
  
  # SOLUTION CODE
  # ============================================
  PLACEHOLDER_CODE_BODY
  
  # TESTING CODE 
  # ============================================
  validate_solution <- function(actual, expected) {
      toString(actual)==toString(expected)
  }
  
  driver <- function(a, b, mod_arg2, expected){
      if (validate_solution(PLACEHOLDER_FN_NAME(a, b, mod_arg2), expected)){
          "PASSED"
      } else{
          "FAILED"
      }
  }
  
  main <- function() {
      cat(sprintf("TEST-0...%s\n",driver(
          60L, 24L, 58L, 
          48L
      )))
  
      cat(sprintf("TEST-1...%s\n",driver(
          46L, 43L, 29L, 
          6L
      )))
  
      cat(sprintf("TEST-2...%s\n",driver(
          4L, 50L, 71L, 
          58L
      )))
  
      cat(sprintf("TEST-3...%s\n",driver(
          67L, 1L, 66L, 
          1L
      )))
  
      cat(sprintf("TEST-4...%s\n",driver(
          93L, 35L, 73L, 
          43L
      )))
  
      cat(sprintf("TEST-5...%s\n",driver(
          89L, 97L, 8L, 
          1L
      )))
  
      cat(sprintf("TEST-6...%s\n",driver(
          8L, 78L, 55L, 
          19L
      )))
  
      cat(sprintf("TEST-7...%s\n",driver(
          53L, 73L, 22L, 
          19L
      )))
  
      cat(sprintf("TEST-8...%s\n",driver(
          96L, 92L, 83L, 
          34L
      )))
  
      cat(sprintf("TEST-9...%s\n",driver(
          38L, 64L, 83L, 
          25L
      )))
  
  }
  
  main()
source_py: def multiply_large_integers_under_large_modulo(a, b, mod):
      res = 0
      a = (a % mod)
      while b:
          if (b & 1):
              res = ((res + a) % mod)
          a = ((2 * a) % mod)
          b >>= 1
      return res
source_cpp: long long multiply_large_integers_under_large_modulo(long long a, long long b, long long mod) {
    long long res = 0;
    a %= mod;
    while ( b ) {
      if ( b & 1 ) res = ( res + a ) % mod;
      a = ( 2 * a ) % mod;
      b >>= 1;
    }
    return res;
  }