#include <iostream>
using namespace std;

long long fib(int n)
{
    long long f0 = 1;
    long long f1 = 1;
    if (n <= 1)
        return 1;
    while (n >= 2)
    {
        long long f2 = f0 + f1;
        f0 = f1;
        f1 = f2;
        n--;
    }
    return f1;
}
int main()
{
    int n;
    while (cin >> n)
    {
        while (n--)
        {
            int a, b;
            cin >> a >> b;
            cout << fib(b - a ) << endl;
        }
    }
}