A masala

n = int(input())
ans = 1
while n>0:
   if sum(int(i) for i in str(ans))% len(str(ans))==0:
       n-=1
   ans+=1
print(ans-1)

 

B masala

a=int(input())
if a<1 or a>1960:
 print('Error')
elif a<3:
 print('Grandmaster')
elif a<10:
 print('International Master')
elif a<27:
 print('Master')
elif a<72:
 print('Candidate Master')
elif a<121:
 print('Expert')
elif a<221:
 print('Specialist')
else:
 print('Pupil')

 

C masala

from statistics import *
a=(map(int,input().split()))
print(round(variance(a)))

 

D masala

a=int(input())
a1,a2,a3,b2,b3=map(int,input().split())
k=int(input())
plus=0
if a>=a1+a2+a3:
 minus=k*(a1+a2+a3)
else:
 minus=k*a
if a>=a1:
 plus=0
a-=a1
if a>=a2:
 a-=a2
 plus+=(a2*b2)
else:
 if a<0:
   a=0
 plus+=(a*b2)
 a-=a2
if a>=a3:
 a-=a3
 plus+=(a3*b3)
else:
 if a<0:
   a=0
 plus+=(a*b3)
 a-=a3
total=plus-minus
if total<=0:
 print(total)
else:
 print('+',total,sep='')

 

E masala

import os
file_path = "najmiddin_py.txt"
if os.path.exists(file_path):
   f = open('najmiddin_py.txt', 'r')
   ii = int(f.readline())
else:
   ii = 1
shashka = [list(input().split()) for i in range(8)]
ans = 0
if ii in [3, 8, 9, 12]: print('Error')
elif ii in [7, 13]: print(0)
else:
   for i in range(8):
       for j in range(8):
           if shashka[i][j]=='1':
               if -1<i-1<8 and -1<j-1<8 and shashka[i-1][j-1]=='.': ans +=1
               if -1<i-1<8 and -1<j+1<8 and shashka[i-1][j+1]=='.': ans +=1
               if -1<i-1<8 and -1<j-1<8 and shashka[i-1][j-1]=='0':
                   if -1<i-2<8 and -1<j-2<8 and shashka[i-2][j-2]=='.': ans+=1
               if -1<i-1<8 and -1<j+1<8 and shashka[i-1][j+1]=='0':
                   if -1<i-2<8 and -1<j+2<8 and shashka[i-2][j+2]=='.': ans+=1
   print(ans)
f = open('najmiddin_py.txt', 'w')
ii+=1
f.write(str(ii))

 

E masala yechimi uchun Najmiddin G'iyosiddinovga rahmat