num = int(eval(input()))



for i in range(45000):

    res = i * (i + 1) / 2

    if res >= num:

        print(i)

        break

x = int(eval(input()))



for i in range(1, 10000000):

    x -= i

    if x <= 0:

        break

print(i)
num = int(eval(input()))
for i in range(45000):
    res = i * (i + 1) / 2
    if res >= num:
        print(i)
        break

x = int(eval(input()))
for i in range(1, 10000000):
    x -= i
    if x <= 0:
        break
print(i)

-num = int(eval(input())) -for i in range(45000): -    res = i * (i + 1) / 2 -    if res >= num: -        print(i) +x = int(eval(input())) +for i in range(1, 10000000): +    x -= i +    if x <= 0: +print(i)