Under construction

Still being built. Things may change

Cheeseburger Making

Time limit1sMemory limit1024 MB

Summary
Given A patties and B cheese slices, find the largest cheeseburger where the patty count is exactly one more than the cheese count.
Level

Easy2 of 10

Topics
Greedy, Math
Solved
No attempts yet

Problem

Seunghyun works at a burger shop that has AA hamburger patties and BB slices of cheese for cooking. To make a cheeseburger, pick at least one patty and at least one slice of cheese, then stack them alternately between the bun halves. The number of patties must be exactly one more than the number of cheese slices.

Seunghyun wants to make one cheeseburger as large as possible from the ingredients in the shop. The size of a cheeseburger is the number of patties plus the number of cheese slices. Find the maximum size of cheeseburger Seunghyun can make.

Input

The first line contains the number of patties AA (2≤A≤1002\leq A\leq 100) and the number of cheese slices BB (1≤B≤1001\leq B\leq 100), separated by a space.

Output

Print the maximum size of cheeseburger Seunghyun can make.

Examples3

  1. Example 1

    Input
    2 1
    
    Expected output
    3
    
  2. Example 2

    Input
    4 5
    
    Expected output
    7
    
  3. Example 3

    Input
    3 3
    
    Expected output
    5