another nice arithmetic operation for the polynomial rolling hash: computing the hash of replace operations without actually performing them.