when I tried to get an input of type Integer, what I only needed to do was the code below.
Scanner sc = new Scanner(System.in); int N = sc.nextInt();
You need to import the BigInteger package:
import java.math.BigInteger;
Include this package and code below:-
Scanner sc=new Scanner(System.in); BigInteger=sc.nextBigInteger();