First Contest of the Year

AtCoder
IDabc438_a
Time2000ms
Memory256MB
Difficulty
On a certain planet, a year has $D$ days, and contests are held every $7$ days. Contests never span across days. The first contest of a certain year was held on the $F$\-th day of the year. On what day of the next year will the first contest of the next year be held? The constraints of this problem guarantee that at least one contest will be held in the next year. ## Constraints * $10 \leq D \leq 366$ * $1 \leq F \leq 7$ * All input values are integers. ## Input The input is given from Standard Input in the following format: $D$ $F$ [samples]
Samples
Input #1
365 4
Output #1
3

If the first contest of a certain year was held on the $4$th day of the year, the first contest of the next year will be held on the $3$rd day of the year.
Input #2
10 5
Output #2
2
API Response (JSON)
{
  "problem": {
    "name": "First Contest of the Year",
    "description": {
      "content": "On a certain planet, a year has $D$ days, and contests are held every $7$ days. Contests never span across days. The first contest of a certain year was held on the $F$\\-th day of the year. On what da",
      "description_type": "Markdown"
    },
    "platform": "AtCoder",
    "limit": {
      "time_limit": 2000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "abc438_a"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "On a certain planet, a year has $D$ days, and contests are held every $7$ days. Contests never span across days.\nThe first contest of a certain year was held on the $F$\\-th day of the year. On what da...",
      "is_translate": false,
      "language": "English"
    }
  ]
}
Full JSON Raw Segments