10的任何次方mod9都是1
所以说事实上就是把l到r加起来而已
然后等差数列求和即可
2在mod9意义下的逆元是5
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
using namespace std;
int mod=9;
long long Simex,Ariche;
int n;
int main(){
scanf("%d",&n);
for(int i=1;i<=n;++i){
scanf("%lld%lld",&Simex,&Ariche);
cout<<(Simex%mod+Ariche%mod)*((Ariche-Simex+1)%mod)%mod*5%mod<<endl;
}
return 0;
}