​http://ybt.ssoier.cn:8088/problem_show.php?pid=1188​


#include<iostream>

using namespace std;

const int maxn=1000000;

const int mod=1000;

int f[maxn+1];

void init()

{

     f[1]=f[2]=1;

     for(int i=3;i<=maxn;i++)

     {

         f[i]=(f[i-1] + f[i-2])%mod;

     }   

}

int main()

{

     init();

     int n;

     cin>>n;

     while(n--)

     {

         int x;

         cin>>x;

         cout<<f[x]<<endl;

     }

    return 0;

}