Pair (pairs)

Description


The children are playing a matching game. There are \(n\) boys and \(m\) girls, numbered \(1 \sim n\) and \(1 \sim m\) respectively. If the sum of the numbers of boy \(i\) and girl \(j\) is a multiple of 5, they are called a reasonable one pair. Program a reasonable total number of pairs.

Format


Input

The first line is a positive integer \(t(≤100)\), which represents the number of data sets;
the next \(t\) line, each line contains two positive integers \(n\) and \(m\) (\(1≤n, m ≤10^8\)), which represent the number of boys and girls, respectively.

Output

For each set of data, output a reasonable total number of pairs.

Sample


Input

2
6 12
21 21

Output

14
88

Sample Code


#include <cstdio>
typedef long long ll;
int main(){
    freopen("pairs.in", "r", stdin);
    freopen("pairs.out", "w", stdout);
    int t, n, m;
    scanf("%d", &t);
    while (t--){
        scanf("%d %d", &n, &m);
        /*ll ans=0;
        for (int i=1; i<=n; i++)
            ans+=m/5+((m%5+i%5)>=5);
            //ans+=(i+m)/5-i/5;
        cout<<ans<<endl;*/
        
        ll x=n/5, y=m/5;
        int u=n%5, v=m%5;
        ll ans=x*y*5+u*y+v*x+((u+v)>4?u+v-4:0);
        printf("%lld\n", ans);
    }
    return 0;
}
posted @ 2020-10-13 00:19  Sample_Test  阅读(140)  评论(0编辑  收藏  举报