Harryxun/stf_run huggingface dataset:
def func(x):
    if x > 1:
        return 2 * func(H//2) + 1
    elif x == 1:
        return 1


H = int(input())

ans = func(H)
print(ans)


### FIXED CODE ###

H = int(input())

bi = bin(H)
bi2 = bi[2:]
ans = 2**len(bi2) - 1
print(ans)
n=int(input())

result=[]
for i in range(1,n+1):
    if i %3==0:
        result.append(i)
    else:
        k=i
        for j in range(1,len(str(n)+1):
            if k%(10**j)==3:
                result.append(i)
                break
            else:
                k=k//10**j
        else:
            continue

print(" ", *result)

### FIXED CODE ###

n=int(input())
 
result=[]
for i in range(1,n+1):
    if i %3==0:
        result.append(i)
    else:
        k=i
        for j in range(1,5):
            if k%10==3:
                result.append(i)
                break
            else:
                k=k//10
        else:
            continue
 
print("",*result)
l=[]
max=0
total=0
for i in range(5):
    t=int(input())
    if t%10 !=0:
        total +=((t//10)+1)*10
        l.append(t)
    else:
        total +=t
a=min(l,key=lambda x:x%10)

print(total-(10-a%10))

### FIXED CODE ###

l=[]
total=0
a=0
for i in range(5):
    t=int(input())
    if t%10 == 0:
        total +=t
    else:    
        total +=(t//10+1)*10
        a=max(a,10-(t%10))
print(total-a)
A,B=map(int,input().split)
if A>8 or B>8:
  print(":(")
else:
  print("Yay!")

### FIXED CODE ###

A,B=map(int,input().split())
if (A>8) or (B>8):
  print(":(")
else:
  print("Yay!")
INP = input().split()
N = int(INP[0])
M = int(INP[N + 1])
#print(N,M)
ans = [0] * N
#print(ans)

for i in range(N):
    for k in range(N):
        if INP[i + 1] == INP[k + 1]:
            print(INP[i + 1])
            ans[i] += 1
for i in range(N):
    for j in range(M):

        if INP[i+1] == INP[N + j + 1]:
            ans[i] -= 1
mx = max(ans)
print(mx)

### FIXED CODE ###

N = int(input())
INPn = [input() for i in range(N)]
M = int(input())
INPm = [input() for i in range(M)]

ans = [0] * N

for i in range(N):
    for k in range(N):
        if INPn[i] == INPn[k]:
            ans[i] += 1
for i in range(N):
    for j in range(M):

        if INPn[i] == INPm[j]:
            ans[i] -= 1

for i in range(N):
    if ans[i] < 0:
        ans[i] = 0
        
mx = max(ans)
print(mx)
N,K=map(int,input().split())
P=list(map(int,input().split()))
C=list(map(int,input().split()))
a=[]
ans=-10**10
for i in range(N):
    idx=P[i]-1
    z=set()
    rl=[]
    c=0
    tc=0
    while idx not in z and c<K:
        tc+=C[idx]
        rl.append(tc)
        ans=max(ans.tc)
        z.add(idx)
        idx=P[idx]-1
        c+=1
    if c<K:
        d,m=divmod(K,c)
        if m==0:
            d-=1
            m=c
        tc=d*tc
        tc+=max(rl[:m])
        ans=max(ans.tc)
print(ans)

### FIXED CODE ###

N,K=map(int,input().split())
P=list(map(int,input().split()))
C=list(map(int,input().split()))
a=[]
ans=-10**10
for i in range(N):
    idx=P[i]-1
    z=set()
    rl=[]
    c=0
    tc=0
    while idx not in z and c<K:
        tc+=C[idx]
        rl.append(tc)
        ans=max(ans,tc)
        z.add(idx)
        idx=P[idx]-1
        c+=1
    if c<K:
        d,m=divmod(K,c)
        if m==0:
            d-=1
            m=c
        tc=d*tc
        tc+=max(rl[:m])
        ans=max(ans,tc)
print(ans)
n=str(input())

if n[0]=n[2]:
    print("Yes")
else:
    print("No")


### FIXED CODE ###

n=str(input())

if n[0]==n[2]:
    print("Yes")
else:
    print("No")
N = int(input())
L = list(map(int,input().split()))

ans = 0

for i in range(N-2):
  for j in range((i+1),N-1):
    for k in range((j+1),N):
      print("i=",i)
      print("j=",j)
      print("k=",k)
      if L[i] < L[j] + L[k] and L[j] < L[i] + L[k] and L[k] < L[j] + L[i]:
        ans += 1
          

    
print(ans)



### FIXED CODE ###

N = int(input())
S = input()

ans = 1

for i in range(N-1):
  if S[i] != S[i +1]:
    ans += 1
    
print(ans)
x = int(input())

print(x)

print("Hello World!")

### FIXED CODE ###

from collections import defaultdict
def readInt():
  return int(input())
def readInts():
  return list(map(int, input().split()))
def readChar():
  return input()
def readChars():
  return input().split()

d,n = readInts()

if d==0:
  if n==100:
    print(101)
  else:
    print(n)
elif d==1:
  if n==100:
    print(10100)
  else:
    print(n*100)
else:
  if n==100:
    print(1010000)
  else:
    print(n*10000)
from sys import stdin
n, q = stdin.readline().split()
s = stdin.readline().strip()
count = 0
for i in range(q):
  l, r = map(int, stdin.readline().split())
  for j in range(l-1, r-1):
    if s[j] + s[j+1] == 'AC':
      count += 1
      
  print(count)


### FIXED CODE ###

from sys import stdin

n, q = map(int, stdin.readline().split())
s = stdin.readline().strip()
counts = [0 for i in range(n)]
count = 0
for i in range(1, n):
    if s[i-1:i+1] == 'AC':
        count += 1
    counts[i] = count

for i in range(q):
    l, r = map(int, stdin.readline().split())
    print(counts[r-1] - counts[l-1])
import math

a, b, x = map(int, input().split())

def calc_theta(a, b, x):
    tmp = (a ** 3) / (2 * (a **2 * b - x))
    tmp2 = (2 * x) / (a ** 2 * b)
    return 90 - math.degrees(math.atan(tmp)), 90 - math.degrees(math.atan(tmp2))



ans1, ans2 = calc_theta(a, b, x)

if ans2 > ans1:
    print(ans2)
else:
    print(ans1)






### FIXED CODE ###

import math

a, b, x = map(int, input().split())

def calc_theta(a, b, x):
    if x >= 0.5 * a ** 2 * b:
        # tmp = (a ** 3) / (2 * ((a **2) * b - x)) これだと 0divになる
        tmp = (2/a)*(b-(x/a**2))
    else:
        tmp = (a * b * b) / (2 * x)
    return math.degrees(math.atan(tmp))

ans = calc_theta(a, b, x)

print('{:.10f}'.format(ans))
x,y = input().split()

if x*4>y and y%2 ==0:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

x,y = input().split()
 
x=int(x)
y=int(y)
count = 0
for i in range(x+1):
  if 2*i+4*(x-i) == y:
    print("Yes")
    count = 1

if count == 0:
	print("No")
n = int(input())
a = int(input())
b = int(input())
if n == 1:
    print('Hellow World')
elif n == 2:
    print(a + b)

### FIXED CODE ###

n = int(input())
if n == 1:
    print('Hello World')
elif n == 2:
    a = int(input())
    b = int(input())
    print(a + b)
n, m = [int(i) for i in input().split(" ")]
e = []
par = [i for i in range(0, n + 1)]
count = [1] * (n + 1)
unu = [0] * m

for i in range(0, m):
    e.append([int(j) for j in input().split(" ")])

def root(x):
    if par[x] == x:
        return x
    else:
        r = root(par[x])
        par[x] = r
        return r

def unite(x, y, e):
    x = root(x)
    y = root(y)
    if x == y:
        return
    else:
        unu[e] = count[x] * count[y]
        count[y] += count[x]
        par[x] = y

for i in reversed(range(0, m)):
    unite(e[i][0], e[i][1], i)

s = 0
for i in range(0, m):
    s += unu[i]
    print(s)

### FIXED CODE ###

import sys

n, m = [int(i) for i in input().split(" ")]
e = []
par = [i for i in range(0, n + 1)]
count = [1] * (n + 1)
unu = [0] * m

sys.setrecursionlimit(10**6)

for i in range(0, m):
    e.append([int(j) for j in input().split(" ")])

def root(x):
    if par[x] == x:
        return x
    else:
        r = root(par[x])
        par[x] = r
        return r

def unite(x, y, e):
    x = root(x)
    y = root(y)
    if x == y:
        return
    else:
        unu[e] = count[x] * count[y]
        count[y] += count[x]
        par[x] = y

for i in reversed(range(0, m)):
    unite(e[i][0], e[i][1], i)

s = 0
for i in range(0, m):
    s += unu[i]
    print(s)
N = int(input())
K = list(str(input()))
count=0


for i in range(N):
  if K[i-1] == "A":
    if K[i] == "B":
      if K[i+1] == "C":
        count += 1

print(count)

### FIXED CODE ###

N = int(input())
K = list(str(input()))
count=0


for i in range(N):  
  if K[i-2] == "A":
    if K[i-1] == "B":
      if K[i] == "C":
        count += 1

print(count)
n = int(input())
l = []
for index in range(n):
    l.append(int(input()))

res = 0
for t0 in range(len(l)-2):
    for t1 in range(t0,len(l)-2):
        for t2 in range(t1, len(l) - 2):
            if(l[t0]!=l[t1] and  l[t1]!=l[t2]  and l[t1]!=l[t2]):
                if(t0+t1>t2 and t0+t2>t1 and t1+t2>t0):
                    res += 1
print(res)

### FIXED CODE ###

n = int(input())
l = list(map(int,input().split()))

res = 0
for t0 in range(0,len(l)-2):
    for t1 in range(t0+1,len(l)-1):
        for t2 in range(t1+1,len(l)):

             if (l[t0] + l[t1] > l[t2] and l[t0] + l[t2] > l[t1] and l[t1] + l[t2] > l[t0] and l[t0]!=l[t1] and l[t1]!=l[t2] and l[t0]!=l[t2]):
                 res += 1

print(res)
s = input()
w = input()
if w >= s:
    print('unsafe')
else:
    print('safe')

### FIXED CODE ###

num = map(int,input().split())
a = []
for i in num:
    a.append(i)
if a[0]<a[1]:
    print('unsafe')
elif a[0]>a[1]:
    print('safe')
else:
    print('unsafe')
N, M =map(int,input().split())
cards = list(map(int,input().split()))
card_pool = [list(map(int,input().split())) for _ in range(M)]
cards.sort()
#print(cards)
card_pool.sort(key=lambda x:x[1],reverse=True)
#print(card_pool)


ruisekiwa = 0
idx = 0
for i in range(M):
    for j in range(card_pool[i][0]):
        if card_pool[i][1] <= cards[idx]:
            break
        ruisekiwa += card_pool[i][1]
        idx += 1
        if idx == N-1:
            break
print(sum(cards[idx:])+ruisekiwa)



### FIXED CODE ###

N,M = map(int,input().split())
*A, = map(int,input().split())
BC=[list(map(int,input().split())) for _ in [0]*M]
A.sort()
BC.sort(key=lambda x:-x[1])
i = 0
for B,C in BC:
    for j in range(i,min(N,i+B)):
        if A[j]<C:A[j]=C
    i = i+B
print(sum(A))
mod=1777777777
n,ma,mb=map(int,input().split())
d=[[mod for j in range(100)] for i in range(100)]
for i in range(n):
    a,b,c=map(int,input().split())
    x=a
    y=b
    d[x][y]=min(d[x][y],c)
    for j in range(100-a):
        for k in range(100-b):
            if d[j][k]!=mod:
                d[j+a][k+b]=min(d[j+a][k+b],d[j][k]+c)
ans=mod
for i in range(100):
    if i%a==0:
        ans=min(ans,d[i][b*i//a])

print([ans,-1][ans==mod])


### FIXED CODE ###

mod=1777777777
n,ma,mb=map(int,input().split())
d=[[mod for j in range(100)] for i in range(100)]
for i in range(n):
    a,b,c=map(int,input().split())
    x=a
    y=b
    for j in range(100-a-1,0,-1):
        for k in range(100-b-1,0,-1):
            if d[j][k]!=mod:
                d[j+a][k+b]=min(d[j+a][k+b],d[j][k]+c)
    d[x][y]=min(d[x][y],c)
ans=mod
for i in range(100):
    if i%ma==0 and mb*i//ma<100:
        ans=min(ans,d[i][mb*i//ma])

print([ans,-1][ans==mod])
n = int(input())

l = list(map(int, input().split()))

for x in l:
  ans = ans*x
  
if(ans > 1000000000000000000):
  print(-1)
else:
  print(ans)

### FIXED CODE ###

def main():
    n = int(input())
    l = list(map(int, input().split()))
    ans = 1
    
    if 0 in l:
      print(0)
      return
 
    for x in l:
        ans = ans*x
        if(ans > 1000000000000000000):
            print(-1)
            return
    print(ans)
 
main()
n=int(input())
print(1 if n==1 else 0.5+int(input())%2/10)

### FIXED CODE ###

n=int(input())
print((n-n//2)/n)
import sys


S = [int(_) for _ in list(input())]
K = int(input())
t = 0
while t <= len(S):
    if S[t] == 1:
        t += 1
    else:
        break

if K <= t:
    print(1)
    sys.exit()
else:
    print(S[t])
    sys.exit()


### FIXED CODE ###

import sys


S = [int(_) for _ in list(input())]
K = int(input())
t = 0
while t <= len(S) - 1:
    if S[t] == 1:
        t += 1
    else:
        break

if K <= t:
    print(1)
    sys.exit()
else:
    print(S[t])
    sys.exit()
N=int(input())
A=map(int,input().split())
x=0
for i in range(N):
    x+=1/A[i]
x=1/x
print(x)


### FIXED CODE ###

N=int(input())
A=list(map(int,input().split()))
x=0
for i in range(N):
    x+=1/A[i]
x=1/x
print(x)
S=input()
if S="SSS":
  print(0)
elif S="RSS":
  print(1)
elif S="RRS":
  print(2)
elif S="RRR":
  print(3)
elif S="SRS":
  print(1)
elif S="SRR":
  print(2)
elif S="RSR":
  print(1)
elif S="SSR":
  print(1)


### FIXED CODE ###

S=input()
if S=="SSS":
  print(0)
elif S=="RSS":
  print(1)
elif S=="RRS":
  print(2)
elif S=="RRR":
  print(3)
elif S=="SRS":
  print(1)
elif S=="SRR":
  print(2)
elif S=="RSR":
  print(1)
elif S=="SSR":
  print(1)
# -*- coding: utf-8 -*-

def parse_input(lines_as_string = None):

    if lines_as_string is None:
        lines = [e for e in input()]
    else:
        lines = [e for e in lines_as_string.split("\n")][1:-1]

    params = lines[0].split(" ")
    a = int(params[0])
    b = int(params[1])

    return (a, b)


def solve(a, b):

    result = 0
    if b % a == 0:
        result = a + b
    else:
        result = b - a

    return result

def main():
    # 出力

    a, b = parse_input()
    print("%d" % solve(a, b))

if __name__ == '__main__':

    main()


### FIXED CODE ###

# -*- coding: utf-8 -*-

def solve(l1):

    l = [int(e) for e in l1.split(" ")]
    a = l[0]
    b = l[1]

    result = 0
    if b % a == 0:
        result = a + b
    else:
        result = b - a


    return str(result)

def main():
    # 出力
    params = []
    for i in range(0, 1):
        params.append(input())   
    print(solve(*params))

if __name__ == '__main__':

    main()
# -*- coding: utf-8 -*-

N, K = map(int,input().split())

A = []

while True:
    a, b = map(int,input().split())
    B = [a for j in range(b)]
    A.extend(B)
    if len(A) >= K:
        print(A[K-1])
        break

### FIXED CODE ###

# -*- coding: utf-8 -*-

a, b, c = map(int,input().split())

if c>=a and c<=b:
    print ("Yes")
else:
    print("No")
a = raw_input()
x = int(a[0])
y = int(a[2])
s = x * y
l = 2 * x + 2 * y
print s,l

### FIXED CODE ###

b = raw_input()
a = b.split()
#print a[1]
x = int(a[0])
y = int(a[1])
s = x * y
l = 2 * x + 2 * y
print s,l
a,b = map(int, input().split())
    print( max(0, a-b*2) )

### FIXED CODE ###

a,b = map(int, input().split())
print(max(0, a-b*2))
A, B = map(int, input())

if A >= 13:
  print(B)
elif 13 > A >= 6:
  print(B//2)
else:
  print(0)

### FIXED CODE ###

A, B = map(int, input().split())

if A >= 13:
  print(B)
elif 13 > A >= 6:
  print(B//2)
else:
  print(0)
import sys
n,m=map(int,input().split())
l=[]
for i in range(m):
    l.append(list(map(int,input().split())))
sortfirst=lambda val:val[0]
l.sort(key=sortfirst)
for i in range(m-1):
    if l[i][0]==l[i+1][0] and l[i][1]!=l[i+1][1]:
        print(-1)
        sys.exit()
if l[0]==[1,0] and n>=2:
    print(-1)
    sys.exit()
ans=[0]*n
for i in range(m):
    ans[l[i][0]-1]=l[i][1]
print("".join(map(str,ans)))


### FIXED CODE ###

import sys
n,m=map(int,input().split())
l=[]
if m==0:
    if n==1:
        print(0)
        sys.exit()
    else:
        print(10**(n-1))
        sys.exit()
for i in range(m):
    l.append(list(map(int,input().split())))
sortfirst=lambda val:val[0]
l.sort()
l.sort(key=sortfirst)
for i in range(m-1):
    if l[i][0]==l[i+1][0] and l[i][1]!=l[i+1][1]:
        print(-1)
        sys.exit()
if l[0]==[1,0] and n>=2:
    print(-1)
    sys.exit()
ans=[1]+[0]*(n-1)
for i in range(m):
    ans[l[i][0]-1]=l[i][1]
print("".join(map(str,ans)))
import math

a, b, c, d = map(int, input().split())


def lcm(x, y):
    if math.gcd(x, y) == 0:
        return x*y
    return x * y / math.gcd(x, y)


def cantdiv(x):
    return x - math.floor(x / c) - math.floor(x / d) + math.floor(x / lcm(c, d))


print(cantdiv(b) - cantdiv(a - 1))


### FIXED CODE ###

from fractions import gcd

a, b, c, d = map(int, input().split())


def lcm(x, y):
    if gcd(x, y) == 0:
        return x * y
    return x * y // gcd(x, y)


def cantdiv(x):
    return x - x // c - x // d + x // lcm(c, d)


print(cantdiv(b) - cantdiv(a - 1))
import sys
for line in sys.stdin:
    list=map(float,line.split())
    x=list[0:6:2]
    y=list[1:6:2]
    xp=list[6]
    yp=list[7]
    xv=[x[a%3]-x[(a+1)%3] for a in xrange(4)]
    yv=[y[a%3]-y[(a+1)%3] for a in xrange(4)]
    xpv=[xp-x[a] for a in xrange(3)]
    ypv=[yp-y[a] for a in xrange(3)]
    cross=[xv[i]*ypv[i]-yv[i]*xpv[i] for i in xrange(3)]
    sorted(cross)
    if (cross[2]>0 and cross[0]>0) or (cross[2]<0 and cross[0]<0): 
        print "YES"
    else:
        print "NO"

### FIXED CODE ###

import sys
for line in sys.stdin.readlines():
    try:
        list=map(float,line.split())
        x=list[0:6:2]
        y=list[1:6:2]
        xp=list[6]
        yp=list[7]
        xv=[x[a%3]-x[(a+1)%3] for a in xrange(4)]
        yv=[y[a%3]-y[(a+1)%3] for a in xrange(4)]
        xpv=[xp-x[a] for a in xrange(3)]
        ypv=[yp-y[a] for a in xrange(3)]
        cross=[xv[i]*ypv[i]-yv[i]*xpv[i] for i in xrange(3)]
        if (cross[2]>0 and cross[1]>0  and cross[0]>0) or (cross[2]<0 and cross[1]<0 and cross[0]<0): 
            print "YES"
        else:
            print "NO"
    except:
        pass
#temp
l = list(map(int,input().split()))
k = int(input())
L =l.sorted()
print(int(l[0])+int(l[1])+int(l[2])*k)

### FIXED CODE ###

a,b,c = map(int,input().split())
k = int(input())
print(a+b+c-max(a,b,c)+max(a,b,c)*(2 ** k))
s=input()
su=0
for i in range(2**(len(s)-1)):
  b=bin(i)[2:].zfill(len(s)-1)
  calcs=s[0]
  for j in range(len(b)):
    if(b[j]=="0"):calcs+=s[j+1]
    else:calcs+="+"+s[j+1]
  sum+=eval(calcs)
print(sum)

### FIXED CODE ###

import sys
s=input()
if(len(s)==1):
  print(s)
  sys.exit()
su=0
for i in range(2**(len(s)-1)):
  b=bin(i)[2:].zfill(len(s)-1)
  calcs=s[0]
  for j in range(len(b)):
    if(b[j]=="0"):calcs+=s[j+1]
    else:calcs+="+"+s[j+1]
  su+=eval(calcs)
print(su)
import math
N, M = input().split()
N = int(N)
M = int(M)


if abs(N - M) > 1:
    print(0)
elif N == M:
    res = math.factorial(N) * math.factorial(M) * 2
else:
    res = math.factorial(N) * math.factorial(M)

print(res % int(1e9 + 7))



### FIXED CODE ###

import math
N, M = input().split()
N = int(N)
M = int(M)

if abs(N - M) > 1:
    print(0)
elif N == M:
    res = math.factorial(N) * math.factorial(M) * 2
    print(res % int(1e9 + 7))
else:
    res = math.factorial(N) * math.factorial(M)
    print(res % int(1e9 + 7))
import math
n=int(input())
A=[int(i) for i in input().split()]
B=[]
for a in A:
  B.append(a)
A.sort(reverse=True)
count=0
for i in range(n):
  cur=A[i]
  if cur in B:
    k=int(math.log2(cur))+1
    pair=2**k-cur
    if pair in B:
      B.remove(pair)
      B.remove(cur)
      count+=1
print(count)


### FIXED CODE ###

import bisect
import collections
def f(n):
  return n.bit_length()
n=int(input())
A=[int(i) for i in input().split()]
D=dict(collections.Counter(A))
C=sorted(list(D.keys()))
ans=0
for i in range(len(C)):
  pair=2**f(C[-(i+1)])-C[-(i+1)]
  k=bisect.bisect_left(C,pair)
  if C[k]==pair:
    if k==len(C)-(i+1):
      ans+=D[pair]//2
      D[pair]%=2
    else:
      aa=min(D[pair],D[C[-(i+1)]])
      ans+=aa
      D[pair]-=aa
      D[C[-(i+1)]]-=aa
print(ans)
distance=[[10**10 for j in range(w)] for i in range(h)]

distance[ch][cw]=0


Q=deque()
Q.append((ch,cw))



while Q:
  p=Q.popleft()
  flag=False

  if p[0]==dh and p[1]==dw:
    break
  
  dx=[1,1,-1,-1]
  dy=[-1,1,-1,1]
  dddx=[0,0,2,-2,2,2,2,2,1,1,1,1,-2,-2,-2,-2,-1,-1,-1,-1]
  dddy=[2,-2,0,0,2,1,-1,-2,2,1,-1,-2,2,1,-1,-2,2,1,-1,-2]

  for i in range(4):
    nx=p[0]+dx[i]
    ny=p[1]+dy[i]

    if 0<=nx<h and 0<=ny<w and maze[nx][ny]!='#' and distance[p[0]][p[1]]<distance[nx][ny]:
      Q.appendleft((nx,ny))
      flag=True
      distance[nx][ny]=distance[p[0]][p[1]]

  if flag:
    continue

  for j in range(20):
    nnnx=p[0]+dddx[j]
    nnny=p[1]+dddy[j]

    if 0<=nnnx<h and 0<=nnny<w and maze[nnnx][nnny]!='#' and distance[p[0]][p[1]]<distance[nnnx][nnny]+1:
      Q.append((nnnx,nnny))
      distance[nnnx][nnny]=distance[p[0]][p[1]]+1


if distance[dh][dw]==10**10:
  print(-1)
  exit()


print(distance[dh][dw])

### FIXED CODE ###

from collections import deque

h,w=map(int,input().split())
ch,cw=map(int,input().split())
dh,dw=map(int,input().split())
ch-=1
cw-=1
dh-=1
dw-=1

maze=[list(input()) for i in range(h)]

Q=deque()
Q.append((ch,cw,0))

dx=[1,0,-1,0]
dy=[0,1,0,-1]
ddx=[2,2,2,2,2,-2,-2,-2,-2,-2,1,1,1,1,-1,-1,-1,-1,0,0]
ddy=[-2,-1,0,1,2,-2,-1,0,1,2,2,1,-1,-2,2,1,-1,-2,2,-2]

dp=[[float('inf')]*w for i in range(h)]


while Q:
  p=Q.popleft()
  if p[0]==dh and p[1]==dw:
    print(p[2])
    exit()
  
  for i in range(4):
    nx=p[0]+dx[i]
    ny=p[1]+dy[i]

    if 0<=nx<h and 0<=ny<w and maze[nx][ny]=='.' and p[2]<dp[nx][ny]:
      Q.appendleft((nx,ny,p[2]))
      dp[nx][ny]=p[2]

  for j in range(20):
    nnx=p[0]+ddx[j]
    nny=p[1]+ddy[j]

    if 0<=nnx<h and 0<=nny<w and maze[nnx][nny]=='.' and p[2]+1<dp[nnx][nny]:
      Q.append((nnx,nny,p[2]+1))
      dp[nnx][nny]=p[2]+1


print(-1)
from collections import deque
import heapq

N, K=map(int, input().split())
V=list(map(int, input().split()))
lim=min(N, K)
ans=0
for num in range(lim+1):
    for A in range(num+1):
        B=num-A
        d=deque(V)
        hands=[]
        while d and len(h)<A:
            hands.append(d.popleft())
        while d and len(h)<A+B:
            hands.append(d.pop())
        heapq.heapify(hands)
        cnt=K-num
        while len(hands) and hands[0]<0 and cnt>0:
            cnt-=1
            heapq.heappop(hands)
        ans=max(ans, sum(hands))
print(ans)

### FIXED CODE ###

import heapq
from collections import deque

N, K=map(int, input().split())
V=list(map(int, input().split()))
limitAB=min(N, K)
ans=0
for num in range(limitAB+1):
  for A in range(num+1):
    B=num-A
    d=deque(V)
    h=[]
    while d and len(h)<A:
      heapq.heappush(h, d.popleft())
    while d and len(h)<A+B:
      heapq.heappush(h, d.pop())
    cnt=0
    while h and h[0]<0 and cnt<K-(A+B):
      heapq.heappop(h)
      cnt+=1
    ans=max(ans, sum(h))
print(ans)
import collections
a = list(str(input()))
b = list(str(input()))
A = collections.Counter(a)
B = collections.Counter(b)
Asort = sorted(A.values())
Bsort = sorted(B.values())
if list(Asort.values()) == list(Bsort.values()):
  print("Yes")
else:
  print("No")

### FIXED CODE ###

import collections
a = list(input())
b = list(input())
A = collections.Counter(a)
B = collections.Counter(b)
Alist = list(A.values())
Blist = list(B.values())
Asort = sorted(Alist)
Bsort = sorted(Blist)
if Asort == Bsort:
  print("Yes")
else:
  print("No")
n=int(input())
a=int(input())
b=int(input())
if n==1:
  print("Hello World")
else:
  print(a+b)


### FIXED CODE ###

n=int(input())
if n==1:
  print('Hello World')
else:
    print(int(input())+int(input()))
def evaluate_positions(positions, cache, assume_origin_set, unevaluated_positions):
    has_conflict = False
    origin_set = assume_origin_set
    for position_data in positions:
        l, r, d = position_data
        if cache[l] != -1 and cache[r] != -1:
            if cache[r] - cache[l] != d:
                has_conflict = True
                break
        elif cache[l] == -1 and cache[r] != -1:
            cache[l] = cache[r] - d
        elif cache[l] != -1 and cache[r] == -1:
            cache[r] = cache[l] + d
        else:
            if not origin_set:
                cache[l] = 0
                cache[r] = d
                origin_set = True
            else:
                unevaluated_positions.append(position_data)
    return has_conflict

if __name__ == '__main__':
    n, m = list(map(int, input().split(" ")))
    cache = [-1 for _ in range(n + 1)]
    positions = []
    for _ in range(m):
        positions.append(list(map(int, input().split(" "))))
    unevaluated_positions = []

    has_conflict = False
    assume_origin_set = False
    while True:
        has_conflict = evaluate_positions(positions, cache, assume_origin_set, unevaluated_positions)
        assume_origin_set = True
        #print("{} vs {}".format(positions, unevaluated_positions))
        if has_conflict:
            break
        if len(unevaluated_positions) == 0:
            break
        if len(positions) == len(unevaluated_positions):
            assume_origin_set = False
        positions = unevaluated_positions
        unevaluated_positions = []

    print("No" if has_conflict else "Yes")



### FIXED CODE ###

if __name__ == '__main__':
    x = int(input())
    a = int(input())
    b = int(input())
    if x <= a:
        print(0)
    else:
        print((x - a) % b)
N = int(input())
A = int(input())
print(N*M-A)

### FIXED CODE ###

N = int(input())
A = int(input())
print(N**2-A)