program LastDigitOfBigInt;
var
bigIntStr: string;
lastDigit: Char;
begin
// Assign the large number as a string literal
bigIntStr := '123456789123456789123456789123';
// Validate: check if all characters are digits
if not (Length(bigIntStr) > 0) then
begin
WriteLn('Invalid input. Empty string.');
Exit;
end;
// Get the last character of the string
lastDigit := bigIntStr[Length(bigIntStr)];
WriteLn('The last digit of the BigInt is: ', lastDigit);
end.
(*
run:
The last digit of the BigInt is: 3
*)