Wow, I figured out the solution to the red envelope problem. Anyone who wants the solution, comment and share the post quickly.