N balls sit in a row. A ball can be painted black or white, and every ball is white at the start. The leftmost ball is ball 1, and the balls are numbered in order from left to right.
Today you want to paint the balls. A machine does the painting, and it reads two integers L and R. The machine paints ball L through ball R entirely in one color, either white or black.
You used the machine M times in total, and you know every L and R you gave it. You forgot which color each use painted.
Write a program that counts how many color combinations can appear after all M uses of the machine.