         let _alpha_k = pow(alpha, U(UIntMax(half)), mod)
         for _ in 0..<half {
             let tpr = op.memory
-            let tphr = (_alpha * oph.memory) % mod
+            let tphr = mulmod(_alpha, oph.memory, mod)
             op.memory = addmod(tpr, tphr, mod)
-            oph.memory = addmod(tpr, (_alpha_k * tphr) % mod, mod)
-            _alpha = (_alpha * alpha) % mod
+            oph.memory = addmod(tpr, mulmod(_alpha_k, tphr, mod), mod)
+            _alpha = mulmod(_alpha, alpha, mod)
             op += out_stride
             oph += out_stride
         }

    var input = input
    var output = output
    
    let a = input.memory % mod
    input += in_stride
    
    let b = input.memory % mod
    
    output.memory = addmod(a, b, mod)
    output += out_stride
    
    output.memory = addmod(a, (modinv(alpha, mod) * b) % mod, mod)
}

public func InverseNumberTheoreticTransform<U: UnsignedIntegerType>(level: Int, _ input: UnsafePointer<U>, _ in_stride: Int, _ alpha: U, _ mod: U, _ output: UnsafeMutablePointer<U>, _ out_stride: Int) {

        let _alpha_k = modinv(pow(alpha, U(UIntMax(half)), mod), mod)
        for _ in 0..<half {
            let tpr = op.memory
            let tphr = mulmod(_alpha, oph.memory, mod)
            op.memory = addmod(tpr, tphr, mod)
            oph.memory = addmod(tpr, mulmod(_alpha_k, tphr, mod), mod)
            _alpha = mulmod(_alpha, _inverse_alpha, mod)
            op += out_stride
            oph += out_stride
        }
