write applyShift.