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

```python

USER_FILENAME = "<user_code>"
import sys, json, builtins
import math, heapq, bisect, itertools, functools, collections, statistics, fractions, decimal, operator, array, random, re, string, os, pathlib
try:
    import resource as _res
except Exception:
    _res = None
from collections import Counter, defaultdict, deque, OrderedDict
from functools import lru_cache, reduce
from itertools import accumulate, permutations, combinations, product
from math import gcd, ceil, floor, sqrt
from decimal import Decimal
try:
    from typing import *
except Exception:
    pass
try:
    sys.setrecursionlimit(1_000_000)
except Exception:
    pass
try:
    import site as _site
    try:
        _sys_sites = _site.getsitepackages() if hasattr(_site, "getsitepackages") else []
        for _p in _sys_sites:
            if _p and _p not in sys.path:
                sys.path.append(_p)
    except Exception:
        pass
    try:
        _usp = _site.getusersitepackages()
        if isinstance(_usp, str):
            _usp = [_usp]
        for _p in _usp:
            if _p and _p not in sys.path:
                sys.path.append(_p)
    except Exception:
        pass
except Exception:
    pass

ns = {"__name__": "__main__"}
for _k, _v in list(globals().items()):
    if not _k.startswith("_"):
        ns[_k] = _v
_CODE = "''' PROBLEM A  '''\r\n\r\n\r\n    \r\n\r\n'''   PROBLEM B   '''\r\n\r\n\r\n\r\n'''   PROBLEM C   '''\r\n\r\n\r\n\r\n\r\n'''   PROBLEM D    '''\r\n\r\n\r\nn=int(input())\r\nfor i in range(0,n):\r\n    p=input().rstrip().split(' ')\r\n    # print(int(p[0]) * int(p[1]))\r\n    A=int(p[0])\r\n    B=int(p[1])\r\n    C=A//B;\r\n    L=[]\r\n    if C<=10:\r\n        M=1;\r\n        ans = 0;\r\n        while(C):\r\n            W=list(str(B*M))\r\n            M+=1;\r\n            ans+=int(W[len(W)-1])\r\n            C-=1;\r\n        print(ans);\r\n    else:\r\n        M=1;\r\n        L=[]\r\n        ans = 0;\r\n        for j in range(0,10):\r\n            W=list(str(B*M));\r\n            M+=1;\r\n            L.append(int(W[len(W)-1]))\r\n            ans+=int(W[len(W)-1])\r\n        D=C//10;\r\n        E=C%10;\r\n        tot=ans*D;\r\n        for j in range(0,E):\r\n            tot+=L[j];\r\n        print(tot)"
_co = compile(_CODE, USER_FILENAME, "exec")
exec(_co, ns, ns)

```

Measured memory_bytes: 13557