A book collector gives the library 4028 books. After this, the library has 51,514 books. How many books did the library have before the cash donations and the gift of books?