Buggy python submission (verdict: Runtime Error):
N=(input())
a = len(N)
if N[a-3]+N[a-2]+N[a-1] =='000':
    print(0)
    
else:
    if a>=3:
        x = int(N[a-3]+N[a-2]+N[a-1])
        print(1000-x)
    elif a==2:
        x = int(N[a-2]+N[a-1])
        print(1000-x)
    else :
        x = int(N[a-1])
        print(1000-x)


Fixed submission:
N=int((input()))

if N%1000==0:
    print(0)
    
else:
  N=str(N)
  a = len(N)
  if a>=3:
        x = int(N[a-3]+N[a-2]+N[a-1])
        print(1000-x)
  elif a==2:
        x = int(N[a-2]+N[a-1])
        print(1000-x)
  else :
        x = int(N[a-1])
        print(1000-x)

Buggy python submission (verdict: Runtime Error):
N=(input())
a = len(N)
if N[a-3]+N[a-2]+N[a-1] =='000':
    print(0)
    
else:
    if a>=3:
        x = int(N[a-3]+N[a-2]+N[a-1])
        print(1000-x)
    elif a==2:
        x = int(N[a-2]+N[a-1])
        print(1000-x)
    else :
        x = int(N[a-1])
        print(1000-x)

Fixed submission:
N=int((input()))

if N%1000==0:
    print(0)
    
else:
  N=str(N)
  a = len(N)
  if a>=3:
        x = int(N[a-3]+N[a-2]+N[a-1])
        print(1000-x)
  elif a==2:
        x = int(N[a-2]+N[a-1])
        print(1000-x)
  else :
        x = int(N[a-1])
        print(1000-x)

Buggy python submission (verdict: Runtime Error):
N=(input())
a = len(N)
if N%1000 ==0:
    print(0)
if a>=3:
    x = int(N[a-3]+N[a-2]+N[a-1])
    print(1000-x)
elif a==2:
    x = int(N[a-2]+N[a-1])
    print(1000-x)
else :
    x = int(N[a-1])
    print(1000-x)

Fixed submission:
N=int((input()))

if N%1000==0:
    print(0)
    
else:
  N=str(N)
  a = len(N)
  if a>=3:
        x = int(N[a-3]+N[a-2]+N[a-1])
        print(1000-x)
  elif a==2:
        x = int(N[a-2]+N[a-1])
        print(1000-x)
  else :
        x = int(N[a-1])
        print(1000-x)

Buggy python submission (verdict: Runtime Error):
N=(input())
a = len(N)
if N%1000 ==0:
  print(0)
if a>=3:
    x = int(N[a-3]+N[a-2]+N[a-1])
    print(1000-x)
elif a==2:
    x = int(N[a-2]+N[a-1])
    print(1000-x)
else :
    x = int(N[a-1])
    print(1000-x)

Fixed submission:
N=int((input()))

if N%1000==0:
    print(0)
    
else:
  N=str(N)
  a = len(N)
  if a>=3:
        x = int(N[a-3]+N[a-2]+N[a-1])
        print(1000-x)
  elif a==2:
        x = int(N[a-2]+N[a-1])
        print(1000-x)
  else :
        x = int(N[a-1])
        print(1000-x)

Buggy python submission (verdict: Runtime Error):
N=(input())
a = len(N)
if a>=3:
    x = int(N[a-3]+N[a-2]+N[a-1])
    print(1000-x)
elif a=2:
    x = int(N[a-2]+N[a-1])
    print(1000-x)
else :
    x = int(N[a-1])
    print(1000-x)

Fixed submission:
N=int((input()))

if N%1000==0:
    print(0)
    
else:
  N=str(N)
  a = len(N)
  if a>=3:
        x = int(N[a-3]+N[a-2]+N[a-1])
        print(1000-x)
  elif a==2:
        x = int(N[a-2]+N[a-1])
        print(1000-x)
  else :
        x = int(N[a-1])
        print(1000-x)

Buggy python submission (verdict: Runtime Error):
N=(input())
a = len(N)
x = int(N[a-3]+N[a-2]+N[a-1])
print(1000-x)

Fixed submission:
N=int((input()))

if N%1000==0:
    print(0)
    
else:
  N=str(N)
  a = len(N)
  if a>=3:
        x = int(N[a-3]+N[a-2]+N[a-1])
        print(1000-x)
  elif a==2:
        x = int(N[a-2]+N[a-1])
        print(1000-x)
  else :
        x = int(N[a-1])
        print(1000-x)