{"problem":{"name":"A. City","description":{"content":"Hi ICPCer, welcome to Xi'an. Being a beautiful ancient city, Xi'an is the capital city of Zhou, Qin, Han, and Tang Dynasties. With a long history, the streets in Xi'an have a grid pattern.  Attracte","description_type":"Markdown"},"platform":"Codeforces","limit":{"time_limit":1000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"CF10247A"},"statements":[{"statement_type":"Markdown","content":"Hi ICPCer, welcome to Xi'an.\n\nBeing a beautiful ancient city, Xi'an is the capital city of Zhou, Qin, Han, and Tang Dynasties. With a long history, the streets in Xi'an have a grid pattern. \n\nAttracted by the streets' structure, Coach _Pang_ would like to conduct his research on them. He draws an $n times m$ grid on the board. The grid consists $n + 1$ vertical line segments and $m + 1$ horizontal line segments. The vertical and horizontal line segments intersect at exactly $(n + 1) times (m + 1)$ points, forming $n times m$ unit squares. We call the $(n + 1) times (m + 1)$ intersections _grid point_s. Output the number of line segments(not only vertical or horizontal) $l$ satisfying the following three conditions: \n\nThe only line contains two integers $n, m$($1 <= n, m <= 1000$).\n\nPrint the answer in a single line.\n\n## Input\n\nThe only line contains two integers $n, m$($1 <= n, m <= 1000$).\n\n## Output\n\nPrint the answer in a single line.\n\n[samples]","is_translate":false,"language":"English"},{"statement_type":"Markdown","content":"**Definitions**  \nLet $ n, m \\in \\mathbb{Z}^+ $ with $ 1 \\leq n, m \\leq 1000 $.  \nConsider a grid with $ (n+1) \\times (m+1) $ grid points, arranged in a rectangular lattice.\n\n**Objective**  \nCount the total number of line segments $ l $ (not restricted to axis-aligned) such that:  \n- Both endpoints of $ l $ are grid points.  \n- The line segment connects two distinct grid points.  \n- The segment lies entirely within the grid (i.e., no restriction on direction beyond endpoint constraints).\n\n**Formulation**  \nThe number of such line segments is the number of unordered pairs of distinct grid points:  \n$$\n\\binom{(n+1)(m+1)}{2}\n$$","is_translate":false,"language":"Formal"}],"meta":{"iden":"CF10247A","tags":[],"sample_group":[],"created_at":"2026-03-03 11:00:39"}}