I am new here but I will have a go. I believe this is called integer overflow, and it may be possible to solve by using an int64? The standard int is a 32 bit which can only contain values between -2,147,483,648 to +2,147,483,647
Using a float may also solve this issue