Go: // 九九を出すだけ
package main
import (
	"fmt"
	"os"
	"bufio"
)
var out = bufio.NewWriter(os.Stdout)

func main(){
	defer out.Flush()
	for i:=1; i<10; i++{
		for j:=1; j<10; j++{
			fmt.Fprintf(out, "%dx%d=%d\n", i, j, i*j)
		}
	}
}

C++: #include <stdio.h>

int main(){
	for(int i=1;i<=9;i++){
		for(int j=1;j<=9;j++){
			printf("%dx%d=%d\n",i,j,i*j);
		}
	}
	getchar();
	return 0;
}

C++: e

C++: #include <iostream>

using namespace std;

int main(void)
{
  for (int i = 1; i < 10; i++)
    for (int j = 1; j < 10; j++)
      cout << i << 'x' << j << '=' << i*j << endl;
  return 0;
}

C++: #include <cstdio>
#include <iostream>

using namespace std;

int main() {
	for (int i=1; i<10; ++i) {
		for (int j=1; j<10; ++j) printf ("%dx%d=%d\n", i, j, i*j);
	}
	system("PAUSE");
	return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
#define FOR(i, s, n) for(int i = s; i < (int)n; i++)
#define per(i, n) for(int i = n; i >= 0; i--)
#define ROF(i, s, n) for(int i = s; i >= (int)n; i--)
#define FORIT(i, A) for (auto i : A)
#define PRINT(x) cout << (x) << "\n"
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define MP make_pair
#define EACH(i, n) for (__typeof((n).begin()) i = (n).begin(); i != (n).end(); ++i)
#define SZ(a) int((a).size())
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define CLR(a) memset((a), 0 ,sizeof(a))
#define NCLR(a) memset((a), -1 ,sizeof(a))
#define dump(x) cout << #x << " = " << (x) << "\n";
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << "\n";
#define sq(n) (n) * (n)
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef priority_queue<int> maxpq;
typedef priority_queue< int, vector<int>, greater<int> > minpq;
typedef complex<double> P;
static const double EPS = 1e-10;
static const double PI = acos( -1.0 );
static const int mod = 1000000007;
static const int INF = 1 << 29;
static const LL LL_INF = 1152921504606846976;
static const int dx[] = { -1, 0, 1, 0, 1, -1, 1, -1 };
static const int dy[] = { 0, -1, 0, 1, 1, 1, -1, -1 };


int main() {
#ifdef _DEBUG
	printf( "debug\n" );
#endif
	for ( int i = 1; i < 10; i++ ) {
		for ( int j = 1; j < 10; j++ ) {
			printf( "%dx%d=%d \n", i, j, i * j );
		}
	}
	return 0;
}

C++: #include<iostream>


int main(){

	int a,b;
		for(a=1;a<10;a++){
			for(b=1;b<10;b++){
				std::cout<<a<<"x"<<b<<"="<<a*b<<std::endl;
			}
		}
return 0;
	


}

C++: #include <iostream>
using namespace std;

int main()
{
	for(int i = 1; i < 10; ++i)
	{
		for(int j = 0; j < 10; ++j)
		{
			cout << i << 'x' << j << '=' << i*j << endl;
		}
	}
	
	return 0;
}

C++: #include<iostream>
#include<cstdio>
using namespace std;
int main(){
  for(int i=1;i<10;i++){
    for(int j=1;j<10;j++){
      printf("%dx%d=%d\n",i,j,i*j);
    }
  }
}

C++: #include<iostream>
using namespace std;
int main(){
	int a=1,b=1,c=0;
	for(int j=0;j<9;j++){
		for(int i=0;i<9;i++){
			c=a*b;
			cout<<a<<'x'<<b<<"="<<c<<endl;
			b++;
		}
		b=1;
		a++;
	}

	return 0;
}

C++: #include<iostream>
using namespace std;
 
int main()
{
    for(int i = 1 ; i <= 9 ; i++){
        for(int j = 1 ; j <= 9 ; j++){
            printf("%dx%d=%d\n",i,j,i*j);
        }
    }
    return 0;
}

C++: 
#include<iostream>
using namespace std;
int main(){
    cout <<"1x1=1" << endl;
    cout <<"1x2=2"<<endl;
    cout <<"1x3=3"<<endl;
    cout <<"1x4=4"<<endl;
    cout <<"1x5=5"<<endl;
    cout <<"1x6=6"<<endl;
    cout <<"1x7=7"<<endl;
    cout <<"1x8=8"<<endl;
    cout <<"1x9=9"<<endl;
    cout <<"2x1=2"<<endl;
    cout <<"2x2=4"<<endl;
    cout <<"2x3=6"<<endl;
    cout <<"2x4=8"<<endl;
    cout <<"2x5=10"<<endl;
    cout <<"2x6=12"<<endl;
    cout <<"2x7=14"<<endl;
    cout <<"2x8=16"<<endl;
    cout <<"2x9=18"<<endl;
    cout <<"3x1=3"<<endl;
    cout <<"3x2=6"<<endl;
    cout <<"3x3=9"<<endl;
    cout <<"3x4=12"<<endl;
    cout <<"3x5=15"<<endl;
    cout <<"3x6=18"<<endl;
    cout <<"3x7=21"<<endl;
    cout <<"3x8=24"<<endl;
    cout <<"3x9=27"<<endl;
    cout <<"4x1=4"<<endl;
    cout <<"4x2=8"<<endl;
    cout <<"4x3=12"<<endl;
    cout <<"4x4=16"<<endl;
    cout <<"4x5=20"<<endl;
    cout <<"4x6=24"<<endl;
    cout <<"4x7=28"<<endl;
    cout <<"4x8=32"<<endl;
    cout <<"4x9=36"<<endl;
    cout <<"5x1=5"<<endl;
    cout <<"5x2=10"<<endl;
    cout <<"5x3=15"<<endl;
    cout <<"5x4=20"<<endl;
    cout <<"5x5=25"<<endl;
    cout <<"5x6=30"<<endl;
    cout <<"5x7=35"<<endl;
    cout <<"5x8=40"<<endl;
    cout <<"5x9=45"<<endl;
    cout <<"6x1=6"<<endl;
    cout <<"6x2=12"<<endl;
    cout <<"6x3=18"<<endl;
    cout <<"6x4=24"<<endl;
    cout <<"6x5=30"<<endl;
    cout <<"6x6=36"<<endl;
    cout <<"6x7=42"<<endl;
    cout <<"6x8=48"<<endl;
    cout <<"6x9=54"<<endl;
    cout <<"7x1=7"<<endl;
    cout <<"7x2=14"<<endl;
    cout <<"7x3=21"<<endl;
    cout <<"7x4=28"<<endl;
    cout <<"7x5=35"<<endl;
    cout <<"7x6=42"<<endl;
    cout <<"7x7=49"<<endl;
    cout <<"7x8=56"<<endl;
    cout <<"7x9=63"<<endl;
    cout <<"8x1=8"<<endl;
    cout <<"8x2=16"<<endl;
    cout <<"8x3=24"<<endl;
    cout <<"8x4=32"<<endl;
    cout <<"8x5=40"<<endl;
    cout <<"8x6=48"<<endl;
    cout <<"8x7=56"<<endl;
    cout <<"8x8=64"<<endl;
    cout <<"8x9=72"<<endl;
    cout <<"9x1=9"<<endl;
    cout <<"9x2=18"<<endl;
    cout <<"9x3=27"<<endl;
    cout <<"9x4=36"<<endl;
    cout <<"9x5=45"<<endl;
    cout <<"9x6=54"<<endl;
    cout <<"9x7=63"<<endl;
    cout <<"9x8=72"<<endl;
    cout <<"9x9=81"<<endl;
    return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;

int main(){
	for(int i=1;i<10;i++) for(int j=1;j<10;j++) cout<<i<<'X'<<j<<'='<<i*j<<endl;
	return 0;
}

C++: #include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>

using namespace std;

#ifdef unix
#define LL "%lld"
#else
#define LL "%I64d"
#endif

const int maxn=100000;
const long long mo=1000000007;

long long va,vb,vc,l,r;

struct state
{
	long long mod,x,y,z;
	bool operator<(const state &a)const
	{
		return mod<a.mod;
	}
}s[maxn],sum[maxn],bsum[maxn];

int find(int size,long long delta_mod)
{
	if (delta_mod<s[1].mod) return 1;
	if (delta_mod>s[size].mod) return size+1;
	int l=0,r=size;
	while (l+1!=r)
	{
		int m=(l+r)>>1;
		if (s[m].mod>=delta_mod) r=m;
		else l=m;
	}
	return r;
}

long long getans(int size,long long nowp)
{
	long long delta_mod=nowp*va%vb;
	int p=find(size,vb-delta_mod);
	long long deltav=nowp*va/vb%mo;
	long long ans=0;
	long long delta=nowp;
	p--;
	if (p) ans=(ans+sum[p].z+sum[p].x*deltav%mo+delta*sum[p].y%mo+delta*deltav%mo*p%mo)%mo;
	p++;
	deltav++;
	if (p<=size) ans=(ans+bsum[p].z+bsum[p].x*deltav%mo+delta*bsum[p].y%mo+delta*deltav%mo*(size-p+1)%mo)%mo;
	return ans;
}

long long solve(long long p)
{
	if (p==0) return 0;
	int size=(int)sqrt(p);
	for (int a=1;a<=size;a++)
	{
		s[a].mod=(va*a+vc)%vb;
		s[a].x=a;
		s[a].y=(va*a+vc)/vb%mo;
		s[a].z=s[a].x*s[a].y%mo;
	}
	sort(s+1,s+size+1);
	sum[0].x=sum[0].y=sum[0].z=0;
	for (int a=1;a<=size;a++)
		sum[a].x=(sum[a-1].x+s[a].x)%mo,sum[a].y=(sum[a-1].y+s[a].y)%mo,sum[a].z=(sum[a-1].z+s[a].z)%mo;
	bsum[size+1].x=bsum[size+1].y=bsum[size+1].z=0;
	for (int a=size;a>=1;a--)
		bsum[a].x=(bsum[a+1].x+s[a].x)%mo,bsum[a].y=(bsum[a+1].y+s[a].y)%mo,bsum[a].z=(bsum[a+1].z+s[a].z)%mo;
	long long nowp=1,ans=0;
	while (nowp+size-1<=p)
	{
		ans=(ans+getans(size,nowp-1))%mo;
		nowp+=size;
	}
	for (long long a=nowp;a<=p;a++)
		ans=(ans+(va*a+vc)/vb%mo*a%mo)%mo;
	return ans;
}

int main()
{
	scanf(LL LL LL LL LL,&va,&vb,&vc,&l,&r);
	printf(LL "\n",(solve(r)-solve(l-1)+mo)%mo);

	return 0;
}

C++: #include<iostream>
using namespace std;

int main(){

    for(int i=1;i<10;i++){
       for(int j=1;j<10;j++){
           printf("%d+%d=%d", i, j, i*j);
       }
    }
    return 0;
}