{"problem":{"name":"F. Unusual Sum","description":{"content":"Bob is an aspiring archaeologist. He has found n ancient scrolls, each with an unusual sum written on it. The sum on the i-th scroll reads as  Bob thinks that precise values of these sums encode the ","description_type":"Markdown"},"platform":"Codeforces","limit":{"time_limit":1000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"CF10079F"},"statements":[{"statement_type":"Markdown","content":"Bob is an aspiring archaeologist. He has found n ancient scrolls, each with an unusual sum written on it. The sum on the i-th scroll reads as \n\nBob thinks that precise values of these sums encode the location of Aldoredo, the not-so-famous city of gold. Help him calculate the values of the sums!\n\nThe first line contains a single integer n, the number of scrolls (1 ≤ n ≤ 105). The i-th of the next n lines contains two space-separated integer numbers li and ri, the description of the sum on the i-th scroll (1 ≤ li ≤ ri ≤ 1018).\n\nOutput n lines: in the i-th line output the value of the sum written on the i-th scroll. Your answer will be considered correct if its relative or absolute error doesn't exceed 10 - 9.\n\n## Input\n\nThe first line contains a single integer n, the number of scrolls (1 ≤ n ≤ 105). The i-th of the next n lines contains two space-separated integer numbers li and ri, the description of the sum on the i-th scroll (1 ≤ li ≤ ri ≤ 1018).\n\n## Output\n\nOutput n lines: in the i-th line output the value of the sum written on the i-th scroll. Your answer will be considered correct if its relative or absolute error doesn't exceed 10 - 9.\n\n[samples]","is_translate":false,"language":"English"},{"statement_type":"Markdown","content":"**Definitions**  \nLet $ n \\in \\mathbb{Z} $ be the number of scrolls.  \nFor each scroll $ i \\in \\{1, \\dots, n\\} $, let $ l_i, r_i \\in \\mathbb{Z} $ denote the bounds of the sum, with $ 1 \\leq l_i \\leq r_i \\leq 10^{18} $.\n\n**Constraints**  \n1. $ 1 \\leq n \\leq 10^5 $  \n2. For each $ i \\in \\{1, \\dots, n\\} $: $ 1 \\leq l_i \\leq r_i \\leq 10^{18} $\n\n**Objective**  \nFor each scroll $ i $, compute the sum:  \n$$\nS_i = \\sum_{k=l_i}^{r_i} k\n$$  \nwhich simplifies to:  \n$$\nS_i = \\frac{(r_i - l_i + 1)(l_i + r_i)}{2}\n$$","is_translate":false,"language":"Formal"}],"meta":{"iden":"CF10079F","tags":[],"sample_group":[],"created_at":"2026-03-03 11:00:39"}}