#B4313. Qualification Requirement for Contest Staff

    ID: 11969 Type: Default 1000ms 256MiB

Qualification Requirement for Contest Staff

Qualification Requirement for Contest Staff

Little M is organizing a Luogu Div.2 Monthly Contest. He has prepared several problems and is seeking a cooperator with problem-setting experience (the team only consists of the two of them). The contest requires that all team members have at least a CCF programming level of (3). In addition, there must be a responsible person in the team who meets one of the following conditions:

  • The person has a level (\geq 8), or
  • The person has a level (\geq 6) and possesses problem-setting experience.

Given Little M’s level and whether he has problem-setting experience, determine the minimum level that his partner should have so that together they satisfy the contest requirements. If it is impossible for the two to meet the requirements, output -1.

inputFormat

The input consists of a single line containing two integers separated by a space: (M) and (E). Here, (M) ((1 \leq M \leq 100)) represents Little M's current CCF level, and (E) is either 1 or 0, where 1 indicates that Little M has problem-setting experience and 0 indicates he does not.

outputFormat

Output a single integer representing the minimum level the partner must have in order for the team to satisfy the contest requirements. If it is impossible for the two to meet the requirements (for example, if Little M's level is below 3), output -1.

sample

8 0
3