private long modulo_inverse(long base, long m){
        long orgM = m;
        long orgBase = base;
        long gcd = GCD(base, m);
        long x = 0;
        long lastX = 1;
        long y = 1;
        long lastY = 0;
        long quotient, tempM,tempX,tempY;
        while(m != 0){
            quotient = base / m;
            tempM = m;
            m = base % m;
            base = tempM;
            tempX = x;
            x = lastX - (quotient * x);
            lastX = tempX;
            tempY = y;
            y = lastY - quotient * y;
            lastY = tempY;
        }
        if(gcd > 1){
            return 0;
        }else{
            Debug.print("lastX:"+lastX+"lastY"+lastY);
            if(lastX > 0){
                return lastX % orgM;
            }else{
                return orgM+(lastX % orgM);
            }
        }
    }