Storing factorial in an array

hello , I have a doubt and want your help. I want to store the factorial till 500 in an array. For ex 5! at 5index and so on till 500. but as factorial of 500 will overflow so how can i use mod to the factorial i used but giving negative values. mod=1e9+7.