Multiplicative inverse

what’s wrong with this code,this is giving the wrong answer bu I think I had correctly applied little fermat’s theorem.
#include<bits/stdc++.h>
using namespace std;
int power(int a,int b){
int res = 1;
while(b){
if(b&1){
res *= a ;
}
a *= a;
b /= 2;
}
return res ;
}
int main(){
int n;
cin>>n ;
int a = power(n,1000000007-2);
cout<<a;

}