Under construction

Still being built. Things may change

Class

Interview

Time limit1sMemory limit1024 MB

Summary
Given n boys and m girls seated two per desk, find the maximum number of students who sit alone or with a student of the other gender.
Level

Easy3 of 10

Topics
Math, Greedy
Solved
No attempts yet

Problem

A geography teacher, Ivan Petrovich, has nn boys and mm girls in his class. He seats the students two per desk. If the number of students is odd, one desk has a single student.

If two boys or two girls share a desk, they get distracted during the lesson. If a boy and a girl share a desk, or a desk has only one student, they listen attentively.

Find the maximum number of students who can listen attentively if Ivan Petrovich seats them correctly.

Input

The first line contains an integer nn (0≤n≤300 \le n \le 30).

The second line contains an integer mm (0≤m≤300 \le m \le 30).

Output

Print one integer: the maximum number of students who can listen attentively.

Hint

Ivan Petrovich can seat a boy and a girl at each of 3 desks and two boys at the fourth desk. Then 6 students listen attentively.

Examples1

  1. Example 1

    Input
    5
    3
    
    Expected output
    6