{"problem":{"name":"032. Prison Break","description":{"content":"Unfortunately, you have been sent to prison because you solved too many problems at CodeQuest 2021. Now, you're trying to break out. Your cell has a combination lock with $n$ dials. You're planning to","description_type":"Markdown"},"platform":"Codeforces","limit":{"time_limit":1000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"CF10269032"},"statements":[{"statement_type":"Markdown","content":"Unfortunately, you have been sent to prison because you solved too many problems at CodeQuest 2021. Now, you're trying to break out. Your cell has a combination lock with $n$ dials. You're planning to try all of the possible combinations of the lock, and you want to know how many possible combinations the lock has.\n\nThe first line of input contains a positive integer $n$: the number of dials on the lock. The next $n$ lines each contain two space-separated integers: the lower and upper limits of each lock dial. For example, if the lower and upper limits were $3$ and $7$, respectively, then the lock dial could turn to 3, 4, 5, 6, or 7.\n\nOutput a single integer $c$: the total number of possible lock combinations.\n\n## Input\n\nThe first line of input contains a positive integer $n$: the number of dials on the lock. The next $n$ lines each contain two space-separated integers: the lower and upper limits of each lock dial. For example, if the lower and upper limits were $3$ and $7$, respectively, then the lock dial could turn to 3, 4, 5, 6, or 7.\n\n## Output\n\nOutput a single integer $c$: the total number of possible lock combinations.\n\n[samples]","is_translate":false,"language":"English"},{"statement_type":"Markdown","content":"**Definitions**  \nLet $ n \\in \\mathbb{Z}^+ $ be the number of dials.  \nFor each dial $ i \\in \\{1, \\dots, n\\} $, let $ [l_i, u_i] \\subseteq \\mathbb{Z} $ denote the range of possible values, where $ l_i $ and $ u_i $ are the lower and upper limits, respectively.\n\n**Constraints**  \nFor each $ i \\in \\{1, \\dots, n\\} $:  \n$ l_i \\leq u_i $\n\n**Objective**  \nCompute the total number of combinations:  \n$$\nc = \\prod_{i=1}^{n} (u_i - l_i + 1)\n$$","is_translate":false,"language":"Formal"}],"meta":{"iden":"CF10269032","tags":[],"sample_group":[],"created_at":"2026-03-03 11:00:39"}}