#include <stdio.h>
#include <ctype.h>
int main()
{
char ch;
int iNumber=0;
long lProduct=1;
while((ch=getchar())!=EOF) //Using getchar()
{
if(isdigit(ch)) //Judge whether the char get from console is digit
{
iNumber=iNumber*10+ch-'0';
}
else if(' '==ch||'\n'==ch) //If the char is not digit,then judge whether it is Space or Enter
{
lProduct*=iNumber;
iNumber=0; //Let iNumber=0,for the next calculation
}
else //If the char is not digt or Space or Enter,it must be other characters like letter,so let iNumber=1,
{ //because when we input other characters like letter,then iNumber will become 0,
iNumber=1; //and everything will become 0.
}
}
printf("%ld\n",lProduct%1000);
}