{"problem":{"name":"A. Petr and a calendar","description":{"content":"Petr wants to make a calendar for current month. For this purpose he draws a table in which columns correspond to weeks (a week is seven consequent days from Monday to Sunday), rows correspond to week","description_type":"Markdown"},"platform":"Codeforces","limit":{"time_limit":2000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"CF760A"},"statements":[{"statement_type":"Markdown","content":"Petr wants to make a calendar for current month. For this purpose he draws a table in which columns correspond to weeks (a week is seven consequent days from Monday to Sunday), rows correspond to weekdays, and cells contain dates. For example, a calendar for January 2017 should look like on the picture:\n\n<center>![image](https://espresso.codeforces.com/489b3cfc33d183f898ec6c5dbd5bfc38dffc297c.png)</center>Petr wants to know how many columns his table should have given the month and the weekday of the first date of that month? Assume that the year is non-leap.\n\n## Input\n\nThe only line contain two integers _m_ and _d_ (1 ≤ _m_ ≤ 12, 1 ≤ _d_ ≤ 7) — the number of month (January is the first month, December is the twelfth) and the weekday of the first date of this month (1 is Monday, 7 is Sunday).\n\n## Output\n\nPrint single integer: the number of columns the table should have.\n\n[samples]\n\n## Note\n\nThe first example corresponds to the January 2017 shown on the picture in the statements.\n\nIn the second example 1\\-st January is Monday, so the whole month fits into 5 columns.\n\nIn the third example 1\\-st November is Saturday and 5 columns is enough.","is_translate":false,"language":"English"},{"statement_type":"Markdown","content":"Petr 想要为当前月份制作一个日历。为此，他画了一个表格，其中列对应周（一周为从周一到周日的连续七天），行对应星期几，单元格包含日期。例如，2017年1月的日历应如下图所示：\n\nPetr 想要知道，给定月份和该月第一天的星期几，他的表格应该有多少列？假设该年为平年。\n\n仅一行包含两个整数 $m$ 和 $d$（$1 ≤ m ≤ 12$，$1 ≤ d ≤ 7$）—— 月份编号（一月为第一个月，十二月为第十二个月）和该月第一天的星期几（$1$ 表示周一，$7$ 表示周日）。\n\n输出一个整数：表格应具有的列数。\n\n第一个示例对应于题面图中所示的2017年1月。\n\n在第二个示例中，1月1日是星期一，因此整个月份只需 $5$ 列即可容纳。\n\n在第三个示例中，11月1日是星期六，$5$ 列已足够。\n\n## Input\n\n仅一行包含两个整数 $m$ 和 $d$（$1 ≤ m ≤ 12$，$1 ≤ d ≤ 7$）—— 月份编号（一月为第一个月，十二月为第十二个月）和该月第一天的星期几（$1$ 表示周一，$7$ 表示周日）。\n\n## Output\n\n输出一个整数：表格应具有的列数。\n\n[samples]\n\n## Note\n\n第一个示例对应于题面图中所示的2017年1月。在第二个示例中，1月1日是星期一，因此整个月份只需 $5$ 列即可容纳。在第三个示例中，11月1日是星期六，$5$ 列已足够。","is_translate":true,"language":"Chinese"},{"statement_type":"Markdown","content":"**Definitions**  \nLet $ m \\in \\{1, \\dots, 12\\} $ be the month number.  \nLet $ d \\in \\{1, \\dots, 7\\} $ be the weekday of the first day of the month ($1 =$ Monday, $7 =$ Sunday).  \nLet $ N(m) $ be the number of days in month $ m $, defined as:  \n$$\nN(m) = \n\\begin{cases}\n31 & \\text{if } m \\in \\{1, 3, 5, 7, 8, 10, 12\\} \\\\\n30 & \\text{if } m \\in \\{4, 6, 9, 11\\} \\\\\n28 & \\text{if } m = 2\n\\end{cases}\n$$\n\n**Constraints**  \n$ 1 \\leq m \\leq 12 $, $ 1 \\leq d \\leq 7 $\n\n**Objective**  \nCompute the number of columns (weeks) required to display the calendar:  \n$$\n\\left\\lceil \\frac{N(m) + d - 1}{7} \\right\\rceil\n$$","is_translate":false,"language":"Formal"}],"meta":{"iden":"CF760A","tags":["implementation","math"],"sample_group":[["1 7","6"],["1 1","5"],["11 6","5"]],"created_at":"2026-03-03 11:00:39"}}