Class
InterviewTime limit1sMemory limit1024 MB
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.
Problem
A geography teacher, Ivan Petrovich, has boys and 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 ().
The second line contains an integer ().
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.