A bookstore had 36 more hardcover books than paperbacks at first. The number of hardcover books sold was equal to 3/4 of the number of paperbacks at first. The bookstore also sold a number of paperbacks that was equal to 1/2 of the number of hardcover books at first. They had an equal number of hardcover books and paperbacks in the end. Find the number of each type of book the bookstore had at first.