He gave 23 cards each to 15 students for a total of 23*15 = <<23*15=345>>345 cards
He has 12 cards left, so originally the number of cards was 345+12 = 357 cards
#### 357