There are $X$ people participating in a quiz competition and their IDs have been numbered from $1$ to $X$ (both inclusive). Beth needs to form a team among these $X$ participants. She has been given an integer $Y$. She can choose participants whose ID numbers are divisible by $Y$. 
Now that the team is formed, Beth wants to know the strength of her team. The strength of a team is the sum of all the last digits of the team members’ ID numbers.
Can you help Beth in finding the strength of her team?

-----Input:-----
- The first line of the input contains a single integer $T$ denoting the number of test cases. $T$ lines follow 
- The first line of each test case contains $X$ and $Y$. 

-----Output:-----
- For each test case print the strength of Beth's team

-----Constraints-----
- $1 \leq T \leq 1000$
- $1 \leq X,Y \leq 10^{20}$

-----Sample Input:-----
2
10 3

15 5

-----Sample Output:-----
18 

10

-----EXPLANATION:-----
- Example case 1: ID numbers divisible by 3 are 3,6,9 and the sum of the last digits are 3+6+9=18

Starter code:

Solutions:
for _ in range(int(input())):
    x, y = map(int, input().split())
    ans = 0
    for i in range(y, x+1, y):
        if i%y == 0:
            ans += i%10
    print(ans)

lt = [[0, 0, 0, 0, 0, 0, 0, 0, 0 ,0],
     [1, 2, 3, 4, 5, 6, 7, 8, 9, 0],
     [2, 4, 6, 8, 0, 2, 4, 6, 8, 0],
     [3, 6, 9, 2, 5, 8, 1, 4, 7, 0],
     [4, 8, 2, 6, 0, 4, 8, 2, 6, 0],
     [5, 0, 5, 0, 5, 0, 5, 0, 5, 0],
     [6, 2, 8, 4, 0, 6, 2, 8, 4, 0],
     [7, 4, 1, 8, 5, 2, 9, 6, 3, 0],
     [8, 6, 4, 2, 0, 8, 6, 4, 2, 0],
     [9, 8, 7, 6, 5, 4, 3, 2, 1, 0]]
for _ in range(int(input().strip())):
    #print("==>>")
    l = input().strip().split(" ")
    #print(l)
    lst = int(l[1][-1])
    f = int(l[0]) // int(l[1])
    fd = f // 10
    fm = int(f % 10)
    #print(f, fd, fm)
    #print(sum(lt[lst]), sum(lt[lst][:fm])))
    t = sum(lt[lst]) * fd + sum(lt[lst][:fm])
    print(t)


for _ in range(int(input())):
    X,Y=list(map(int,input().split()))
    su=0
    for i in range(1,X+1):
        if (Y*i)>X:
            break
        su+=(Y*i)%10
    print(su)


# cook your dish here
t=int(input())
for _ in range(t):
    x,y=list(map(int,input().split()))
    sum=0
    y1=y
    while y1<=x:
        sum+=y1%10
        y1+=y
    print(sum)

        
    


for _ in range(int(input())):
    x,y=[int(x) for x in input().split()]
    if x<y:
        print(0)
    else: 
        s=0
        for _ in range(y,x,y):
            s+=(_%10)
        print(s)    
        # team1,team2,res=[],[],0
        # for _ in range(1,x+1):
        #     if _%y==0:
        #         team1.append(_)
        #     else:
        #         team2.append(_)
        # for _ in range(len(team1)):
        #     res+=(team1[_]%10)
        # print(res)    


t=int(input())
for i in range(t):
    x,y=list(map(int,input().split()))
    sum=0
    for j in range(int(x/y)+1):
            sum=sum+(j*y)%10
    print(sum)   


for _ in range(int(input())):
    a,b=map(int,input().split())
    ans=0
    y=a//b
    x=b
    for i in range(y):
        x=x%10
        ans+=x
        x+=b
    print(ans)

# cook your dish here
summ=[0,45,40,45,40,25,40,45,40,45,0]
arr=[ ]

for i in range(0,10):
    curr=[]
    for j in range(1,11):
        mul = i*j
        rem = mul%10
        curr.append(rem)
    arr.append(curr)

# print(arr)







for _ in range(int(input())):
    num,n =(int(x) for x in input().split())
    count = (num//(n*10))
    ans = count *(summ[n%10])
    rem= (num-count*(n*10))//(n)
    # print("rem",rem)
    c=0
    for i in range(rem):
        # print(arr[n%10][i])
        s=n%10
        # print("s",s)
        c += arr[s][i]
        # print(arr[s][i])
    # print(ans,c)
    print(ans+c)


n=int(input())
while(n>0):
 n=n-1
 p,k=list(map(int,input().split()))
 sum=0
 i=k
 while(i<=p):
  sum=sum+(i%10)
  i=i+k
 print(sum)



# cook your dish here
for t in range (int(input())):
    x, y = map(int, input().split())
    ans = 0
    for i in range (y, x + 1, y):
        ans += int(str(i)[-1])
    print(ans)

for _ in range(int(input())):
    x, y = map(int, input().split())
    
    strength = 0
    for i in range(y,x+1,y):
        strength += (i%10)
    
    print(strength)

# cook your dish here
t=int(input())
for i in range(0,t):
    x,y=map(int, input().split())
    s=0
    b=[]
    for j in range(1,10):
        b.append((y*j)%10)
    if(x//y)<10:
        for j in range(0,x//y):
            s+=b[j]
    else:
        s+=((x//y)//10)*sum(b)
        for j in range(0,(x//y)%10):
            s+=b[j]
    print(s)

# cook your dish here
t=int(input())
while(t!=0):
    x,y=map(int,input().split())
    s=0
    i=1
    while(i!=-1):
        q=y*i
        if q<10:
            s+=q
            #print(s,q)
        else:
            s+=(q%10)
        i+=1
        if i*y>x:
            i=-1
        
        #for i in range(y,x+1):
        #if (i%y == 0):
            #if i>=10:
                #s+=(i%10)
            #if i<10:
                #s=s+i
    print(s)
    t-=1

# cook your dish here
t=int(input())
while(t!=0):
    x,y=map(int,input().split())
    s=0
    i=1
    while(i!=-1):
        q=y*i
        if q<10:
            s+=q
            #print(s,q)
        else:
            s+=(q%10)
        i+=1
        if i*y>x:
            i=-1
        
        #for i in range(y,x+1):
        #if (i%y == 0):
            #if i>=10:
                #s+=(i%10)
            #if i<10:
                #s=s+i
    print(s)
    t-=1

# cook your dish here
t=int(input())
while(t!=0):
    x,y=map(int,input().split())
    s=0
    i=1
    while(i!=-1):
        q=y*i
        if q<10:
            s+=q
            #print(s,q)
        else:
            s+=(q%10)
        i+=1
        if i*y>x:
            i=-1
        
        #for i in range(y,x+1):
        #if (i%y == 0):
            #if i>=10:
                #s+=(i%10)
            #if i<10:
                #s=s+i
    print(s)
    t-=1

# cook your dish here
t = int(input())
while t>0:
    x,y = map(int, input().split())
    sum1 = 0
    for i in range(y, x+1, y):
        sum1+=int(str(i)[-1])
    print(sum1)
    t-=1

# cook your dish here
t = int(input())
while(t>0):
    x,y = map(int,input().split())
    res=1
    i=1
    strength=0
    while((y*i)<=x):
        res = y*i
        strength += (res%10)
        
        i+=1
    print(strength)
    t-=1

t=int(input())
for i in range(t):
    x,y= list(map(int, input().split()))
    m=x//y
    sum1=0
    l=[]
    for i in range(1,m+1):
        n=y*i
        l.append(n)
    for i in range(len(l)):
        q=l[i]%10
        sum1=sum1+q
    print(sum1)    


def sumOfLastDig(n, m) :  
    sum = 0;  
    k = n // m; 
    arr = [0] * 10;  
    for i in range(10) : 
        arr[i] = m * (i + 1) % 10;  
        sum += arr[i];  
    rem = k % 10;  
    ans = (k // 10) * sum;  
    for i in range(rem) : 
        ans += arr[i];  
    return ans;  

def __starting_point():  
    for i in range(int(input())):
        m,n = list(map(int,input().strip().split()))
        print((sumOfLastDig(m,n)));  
        

__starting_point()

for _ in range(int(input())):
    x,y=map(int,input().split())
    l=[]
    s=0
    y1=y
    i=1
    while(y1*i<=x):
        l.append(str(y1*i))
        i+=1
    for i in l:
        s+=int(i[-1])
    print(s)

def sumOfLastDig(n, m) :  
    sum = 0;  
    k = n // m; 
    arr = [0] * 10;  
    for i in range(10) : 
        arr[i] = m * (i + 1) % 10;  
        sum += arr[i];  
    rem = k % 10;  
    ans = (k // 10) * sum;  
    for i in range(rem) : 
        ans += arr[i];  
    return ans;  

def __starting_point():  
    for i in range(int(input())):
        m,n = list(map(int,input().strip().split()))
        print((sumOfLastDig(m,n)));  
        

__starting_point()

def sumOfLastDig(n, m) :  
    sum = 0;  
    k = n // m; 
    arr = [0] * 10;  
    for i in range(10) : 
        arr[i] = m * (i + 1) % 10;  
        sum += arr[i];  
    rem = k % 10;  
    ans = (k // 10) * sum;  
    for i in range(rem) : 
        ans += arr[i];  
    return ans;  

def __starting_point():  
    for i in range(int(input())):
        m,n = list(map(int,input().strip().split()))
        print((sumOfLastDig(m,n)));  
        

__starting_point()

''' PROBLEM A  '''


    

'''   PROBLEM B   '''



'''   PROBLEM C   '''




'''   PROBLEM D    '''


n=int(input())
for i in range(0,n):
    p=input().rstrip().split(' ')
    # print(int(p[0]) * int(p[1]))
    A=int(p[0])
    B=int(p[1])
    C=A//B;
    L=[]
    if C<=10:
        M=1;
        ans = 0;
        while(C):
            W=list(str(B*M))
            M+=1;
            ans+=int(W[len(W)-1])
            C-=1;
        print(ans);
    else:
        M=1;
        L=[]
        ans = 0;
        for j in range(0,10):
            W=list(str(B*M));
            M+=1;
            L.append(int(W[len(W)-1]))
            ans+=int(W[len(W)-1])
        D=C//10;
        E=C%10;
        tot=ans*D;
        for j in range(0,E):
            tot+=L[j];
        print(tot)

T = int(input())
while(T):
    xy = [int(x) for x in input().split()]
    st = 0
    n = xy[0] //xy[1]
    for i in range(1,n+1):
        st+=int(str(i*xy[1])[-1])
    print(st)
    T =T-1

# cook your dish here
t=int(input())
while t>0:
    n,m=list(map(int,input().split()))
    p=n//m
    m%=10
    q=(2*m)%10
    r=1
    sm=m
    while q!=m:
        sm+=q
        q+=m
        q%=10
        r+=1
    sm*=(p//r)
    p%=r
    q=m
    while p>0:
        sm+=q
        q+=m;
        q%=10
        p-=1
    print(sm)
    t-=1