Sometimes you have to force long constant values by appending an "L" at the end of each constant, for example 4096L.
Also be aware of the order of operations in the arithmetic.
Since this is done in integer arithmetic, you have to be aware of overflows or loss of precision.
Mind you what you are doing seems to be correct, except that this expression results in a constant and the compiler could very well be preprocessing it to give a constant literal.
The effect of the parentheses in the first expression is to multiply 1001 * 666, which gives you an intermediate product of 666,666. Your compiler is not smart enough to assign a long enough intermediate variable, hence it protests that the number is out of range. That's what you get for using C-like languages. In my business, C is merely average, neh?