the method is similar to binary addtion
sol of q067