Repsept

AtCoder
IDabc174_c
Time2000ms
Memory256MB
Difficulty
Takahashi loves the number $7$ and multiples of $K$. Where is the first occurrence of a multiple of $K$ in the sequence $7,77,777,\ldots$? (Also see Output and Sample Input/Output below.) If the sequence contains no multiples of $K$, print `-1` instead. ## Constraints * $1 \leq K \leq 10^6$ * $K$ is an integer. ## Input Input is given from Standard Input in the following format: $K$ [samples]
Samples
Input #1
101
Output #1
4

None of $7$, $77$, and $777$ is a multiple of $101$, but $7777$ is.
Input #2
2
Output #2
\-1

All elements in the sequence are odd numbers; there are no multiples of $2$.
Input #3
999983
Output #3
999982
API Response (JSON)
{
  "problem": {
    "name": "Repsept",
    "description": {
      "content": "Takahashi loves the number $7$ and multiples of $K$. Where is the first occurrence of a multiple of $K$ in the sequence $7,77,777,\\ldots$? (Also see Output and Sample Input/Output below.) If the seque",
      "description_type": "Markdown"
    },
    "platform": "AtCoder",
    "limit": {
      "time_limit": 2000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "abc174_c"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "Takahashi loves the number $7$ and multiples of $K$.\nWhere is the first occurrence of a multiple of $K$ in the sequence $7,77,777,\\ldots$? (Also see Output and Sample Input/Output below.)\nIf the seque...",
      "is_translate": false,
      "language": "English"
    }
  ]
}
Full JSON Raw Segments