To write a complete yet simple Prolog program, which reads a list of students containing their name, address, student ID and grades of five subjects. The program should also be able to search for students by their name or student ID and giving a list of their full details and also add a new record.