Under construction

Still being built. Things may change

Chopsticks

Time limit1sMemory limit512 MB

Summary
Given N kinds of chopsticks in unlimited supply, find how many must be drawn to guarantee R pairs in the worst case.
Level

Easy3 of 10

Topics
Math, Combinatorics, Greedy, Implementation
Solved
No attempts yet

Problem

A chopstick holder contains NN kinds of chopsticks, with plenty of each kind. You draw chopsticks at random from this holder and must form RR pairs. In the worst case, how many chopsticks must you draw?

Input

Two integers N,RN, R are given. (1≤N,R≤1018)(1 ≤ N,R ≤ 10^{18})

Output

Print the number of chopsticks that must be drawn in the worst case.

Examples1

  1. Example 1

    Input
    2 1
    
    Expected output
    3