fork download
  1. // █▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀█
  2. // █░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░█
  3. // █░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░█
  4. // █░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░▄▄▄▄█▀███▀▀▀▀▀██▀▀▀▀▄▄▄▄░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░█
  5. // █░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░▄▄█▀▀░░▄▄██▀▀░░░▄█▀░░░░░░░▄█▀█▄▄░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░█
  6. // █░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░▄█▀▀░░░▄▄█▀█▀░░░░▄█░░░░░░░░░░░▀█░▀███▄▄░░░░░░░░░░░░░░░░░░░░░░░░░░█
  7. // █░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░▄█▀░▄▄░▄█▀░░▄▀░░░░▄█░░░░░░░░░░░░░▀█░░█▄░▀█▄░░░░░░░░░░░░░░░░░░░░░░░░█
  8. // █░░░░░░░░░░░░░▄▄▄▄▄▄▄░░░░░░░░░░█▀▄█▀▀░█▀░░▄█▀░░░░█▀░░░░░░░░░░░░░░░█░░░█░░░░▀█░░░░░░░░░░░░░░░░░░░░░░█
  9. // █░░░░░░░░░░░░▀█▄▄▄▄▄█▀█▄░░░░░▄▀▄█▀░░░█░░░▄█░░░░░░█░░░░░░░░░░░░░░░░█░░░█░░░░░░█▄░░░░░░░░░░░░░░░░░░░░█
  10. // █░░░░░░░░░░░▄▄▀▀░░░░▀▀░▀█░░▄███▀░░░░░█░░░█░░░░░░░█░░░░░░░░▄░░░░░░░█░░░█░░░░░█░▀█▄░░░░░░░░░░░░░░░░░░█
  11. // █░░░░░░░░░▄█▀▄█▀░░▄█░░░░▀█▄▀▄█░░▄░░░░▀░░░░░░░░░░▄█░░░░░░░░█░░░░░░░█░░░█░░░░░█░░░█▄░░░░░░░░░░░░░░░░░█
  12. // █░░░░░░░░██▄██▀░░█▀░░▄▄▄▀▄██▀░░░█░░▄░░░░░░░░░░░░█▀░░░░░░░█▀░░░░░░██░░░█░░░░░█░░░░█▀▄░░░░░░░░░░░░░░░█
  13. // █░░░░░░░░▀░░█▀░▄██▄▄█▀░░▄██░░░░░█░░█░░░░░▄░░░░░░▀█░░░░░░░█░░░░░░▄█░░░░█░░░░░█░░░░░░▀█▄░░░░░░░░░░░░░█
  14. // █░░░░░░░░░░░█▄█▀░█▀░░░░▄█▀░░░░░░█░░█░░░░░█░░░░░░░█░░░░░░░█░░░░░▄█░░░░▄█░░░░░█░░░░░░░░▀▄▄▄█▀▀█▄░░░░░█
  15. // █░░░░░░░░░░░▀▄▄██▀▄▄▄▀▀▀█░░░░░░░█░░█░░░░░█░▄▄▄▄▄▄▀▀▀▀▀▀▀▀█▄▄▄▄▄█▄▄░░░█░░░░░░█░░░▄░░░░░█░░▄▄▄░█░░░░░█
  16. // █░░░░░░░░░░▄█▀▄█░▀█░░░░█▀░░░░░░░█░░█░█░░░███▄█▀██████▀▀▀▀▀░░░░░░░▀▀█▄█░░░░░▄█░░░█░░░░░█░░░▀████░░░░█
  17. // █░░░░░░░░░█▀░█▀░░░█░░░░█░░░░░░░░█░░█░█▄░█▀░░░░░▀███▄▀▀░░░░░░░░░▀▀▀█▄██▄▄▄░░█░░░░█░░░░░█░░░░░▀▀█▄░░░█
  18. // █░░░░░░░░▄█▄░░░▄▄█░░░░░█░░░░░░░░█░░█▀▀▀▀░░░░░░░██▄██░░░░░░░░░░░░█▀███▀▀▄█▀▀▀█▄▄░█░░░░░▀█░░██▄░░█▄░░█
  19. // █░░░░░░░█▀▄██▀██░░░░░░░█░░░░░░░░█▄░▀█░░░░░░░░░░░░░░░░░░░░░░░░░░░▄▄███░░░▀█▄░░░▀▀█░░░█░░█░░▀█▀▀█▄█░░█
  20. // █░░░░░░░█░▀░░▄█░░░░░░░░█░░░░░░░░░█▄░▀█▄░░░▄▄▄▄▄▄▄▄▄▄░░░░░█▀░░░░░▀▀▀▀░░░░░░▀█░░░▄█░░▄▀░░█░▄▄█░░░▀▀░░█
  21. // █░░░░░░▄▀░░▄█▀░░░░░░░█▀█░░░░░▄░░░░█▄░░▀█▀▀▀░░░░░░░░░░░░░░░░░░░░▀█▄▄▄░░░░░░░░█▄░█░░▄█░░░██▀░░░░░░░░░█
  22. // █░░░░░██░▄█▀█░░░░░░░░█░▀▄░░░░░█░░░▀██▄▄▀█▄░░░░░░░░░░░░░▀▀░░░░░░░░░░▀▀█▄▄░░░░░██▀░▄█░░░███░░░░░░░░░░█
  23. // █░░░░▄█▀█▀░▄▀░░░░░░░░█░░█░░░░░░█▄░░▀▄░░▀▀██░░░░░░░▄▄▄▄▄▄▄▄▄░░░░░░░░░░░░▀▀▄▄▄▄█▄▄▀▀░░░░█░▀▄░░░░░░░░░█
  24. // █░░░░█░░░▄█▀░░░░░░░░░█▄░█▄░░░░░░▀█▄░▀█░░░░░▄▀▀▄░█▀▀░░░░░░░▀▀▀▀█▄░░░░░░░░░░░░█▀█░░░░░░░█░░█░░░░░░░░░█
  25. // █░░░░▀█░▄▀█░░░░░░░░░░░▀█▄██░░░░░░░░████▄░░█▀░░░▀░░░░░░░░░░░░░░░▀▀▄░░░░░░░░░░░░█░░░░░░█▀░░█▄░░░░░░░░█
  26. // █░░░░░█▄▀░█░░░░░░░░░░░░█░░░░░░█▀█▄░█▄░░▀▀░█░░░░░░░░░░░░░░░░░░░░░░█░░░░░░░░░░░░██▀█░░░▀▄░░░█░░░░░░░░█
  27. // █░░░░█▀░░░█▄▄░░░░░░░░░░█░░░██▄█░░▀█▄▀▄░░░░█▄░░░░░░░░░░░░░░░░░░░░░█░░░░░░░░░▄▄▀░▄█▀▀▀█░▀█▄░█░░░░░░░░█
  28. // █░░░░▀▄▄▄▄█▄▀█░░░░░░▄▄▄██▄▄█▄██▄░░██▄██░░░░█░░░░░░░░░░░░░░░░░░░░░█░░░░░░░░░█░░▄▀░░█▀█░░░░░█░░░░░░░░█
  29. // █░░░░░▀█▀░░░▄█▄█▀▀▀▀▀░░░░░░░█░██░░█░█▄▄▀▀▀▀▀▀▀▀▄▄▄▄▄▄░░░░░░░░░░░█▀░░░██▄░░█▀▄█░░▄█░░█░░░▄▄█░░░░░░░░█
  30. // █░░░░░░█▄░▄█▀░░░░░░░░░░░░░░░░█░█▄░█░█░▀█░░░░░░░░░░░░█▀▀▀▀▀▀▄▄▄▄██░░░█▀░█░█▀█▀░▄▄▀░▄█▀░░▀▀░█░░░░░░░░█
  31. // █░░░░░░░█▀▀░░░░░░░░░░░░░░░░░░█▄░█░█░█░░█░░░░░░░░░░░░█░░░░▄▄▄░░█░▀▀▀▀█░░██▀░░▄█▀░▄█▀░▀█░░░░█░░░░░░░░█
  32. // █░░░░░░█░░░░░░▄▄████████▄░░░░░█░░░█▄█░░█░░░░░░░░░░░░█░░░░███░░█░░░░░█░▄█▀░░░░░▄██▄░░░▀▀░░█░░░░░░░░░█
  33. // █░░░░░░█░░░░░█████████████▄░░░▀█░░░░▀░░▀▄░░░░░░░░░░░█░░░░░░░░░█░░░░░█▄▀░░░░▄░░█░░░▀█▄▄█▀▀░░░░░░░░░░█
  34. // █░░░░░░█▄░░░░▀███████▀▀▀▀▀█▄░░░▀▄░░░░░░░█░░░░░░░░░░░█░░░░░░░░░█░░░░█▀▀░░▄█▀░░█░░░░░██░░░░░░░░░░░░░░█
  35. // █░░░░░░░█░░░░░░███▀░░░░░░░░▀▄░░░▀█░░░░░░█░░░░░░░░░░░█░░░░░░░░░█░░░█▀░░░█▀░░░█▀░░░░▄█░░░░░░░░░░░░░░░█
  36. // █░░░░░░░▀▄░░░░░██░░░░░░░░░░░░▀░░░█░░░░░░▀█░░▄▄░░░░░░█░░░░░░░░▄█░░░█░░▄█░░░░░█░░░░░█░░░░░░░░░░░░░░░░█
  37. // █░░░░░░░░▀█░░▄█▀░░░░░░░░░░░░░░░░▄█░░░░░░░▀█░▀▀▀▀▀█▄▄█▄▄▄▄▄▄▄▄█▄▄▄█▀░░█░░░░░▄█░░░░░█░░░░░░░░░░░░░░░░█
  38. // █░░░░░░░░░█░▄▀░░░░░░░░░░░░░░░▄█▀▀▀█▄░░░░░░▀█░░░░░░▀▀██████████████░░█▀░░░░░█░░░░░█▀░░░░░░░░░░░░░░░░█
  39. // █░░░░░░░░░██▀░░░░░░░░░░░░░░▄██░░░░░█▄░░░░░░█░░░░░░░░█░░░░░▀▀▀▀▀█▀█░░█░░░░░░█░░░░░█░░░░░░░░░░░░░░░░░█
  40. // █░░░░░░░░░██▀░░░░░░░░░░░░░░██░░░░░░░█▄░░░░░█░░░░░░░░█░░░░░░░░░░█░▀█▄█░░░░░░███▄░░▀▄░░░░░░░░░░░░░░░░█
  41. // █░░░░░░░░░██▄▄░░░░░░░░░░░░▄██░░░░░░░░▀█▄░▄█▀░░░░░░░░█░░░░░░░░░▄█░░█▄░░░░░░░██░▀█▄░▀█░░░░░░░░░░░░░░░█
  42. // █░░░░░░░▄██▀░▀█▄░░░░░░░░░░██▀░░░░░░░░░░▀▀█░░░░░░░░░▄▀░░░░░░░░▄█░░░██▄░░░░░▄██░░░█▄░▀█░░░░░░░░░░░░░░█
  43. // █░░░░░░░██▀░░░░▀▀▄▄░░░░░░██▀█▄░░░░░░░░░░░▀▀▄▄▄▄▄▄▄▄█▄▄▄▄▄▄▄░░█░░░▄▀░█░░░░░▀░█░░░░▀▄░▀█░░░░░░░░░░░░░█
  44. // █░░░░░░██▀░░░░░░░░▀█▄░░▄██▀░░░▀▄░░░░░░░░░░░░▀██████████████████▄█▀░░▀█░░░░░░█░░░░░█▄░▀▄░░░░░░░░░░░░█
  45. // █░░░░░░██░░░░░░░░░░░▀█▄██▀░░░░░░█▄░░░░░░░░░░░▀███████████████████░░░░▀█░░░░█▀░░░░░░█░░█░░░░░░░░░░░░█
  46. // █░░░░░██░░░░░░░░░░░░░░██▀░░░░░░░░▀█▄░░░░░░░░░░▀█████████████████▀░░░░░▀█░░▄█░░░░░░░█▄░░█░░░░░░░░░░░█
  47. // █░░░░▄█░░░░░░░░░░░░░▄██▀░░░░░░░░░░░▀█▄░░░░░░░░░▀████████████████░░░░░░░▀▄█▀░░░░░░░█▀█░░▀▄░░░░░░░░░░█
  48. // █░░░░█░░░░░░░░░░░░▄▄██▀░░░░░░░░░░░░░░█▄░░░░░░░░░░██▀▀▀▀▀▀██▀▀▀█▀░░░░░░░░█▀░░░░░░░▄█░█▄░░▀█▄░░░░░░░░█
  49. // █░░░░█░░░░░░░░░░░███▀░░░░░░░░░░░░░░░░░█▄░░░░░░░░░░█▄░░░░░█░░░░█░░░░░░░▄█▀░░░░░░░▄█░░░█░░░░▀▄░░░░░░░█
  50. // █▄▄▄▄█▄▄▄▄▄▄▄▄▄▄██▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄█▄▄▄▄▄▄▄▄▄▄▄█▄▄▄▄▄█▄▄▄▄█▄▄▄▄▄▄▄█▄▄▄▄▄▄▄▄▄█▄▄▄▄█▄▄▄▄▄██▄▄▄▄▄▄█
  51. #include<bits/stdc++.h>
  52. using namespace std;
  53. long long l,r;
  54. int n;
  55. long long a[1000001];
  56. bool nt(long long x){
  57. if(x<2)return 0;
  58. for(long long i=2;i*i<=x;i++){
  59. if(x%i==0)return 0;
  60. }
  61. return 1;
  62. }
  63. void process(){
  64. n=0;
  65. for(long long i=l;i<=r;i++){
  66. if(nt(i))a[++n]=i;
  67. }
  68. long long ans=0;
  69. long long now=1;
  70. for(int i=1;i<n;i++){
  71. while(now<a[i])now*=10;
  72. for(long long j=1;1;j++){
  73. if((j*now+a[i])%a[i+1]==0){
  74. ans+=(j*now+a[i])%1000000007;
  75. break;
  76. }
  77. }
  78. }
  79. cout<<ans%1000000007;
  80. }
  81. void init(){
  82. cin>>l>>r;
  83. }
  84. int main(){
  85. ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
  86. #define NAME "nazunasdish"
  87. if(fopen(NAME".inp","r")){
  88. freopen(NAME".inp","r",stdin);
  89. freopen(NAME".ans","w",stdout);
  90. }
  91. clock_t beg=clock();
  92. init();
  93. process();
  94. cerr<<double(clock()-beg)/CLOCKS_PER_SEC;
  95. }
  96.  
Success #stdin #stdout 0s 5312KB
stdin
Standard input is empty
stdout
Standard output is empty