Below is an instruction that describes a task. Write a response that appropriately completes the request.

### Instruction:
How many total medals does rank 3 with less than 40 silver medals?

### Inputs:
table_name: table, columns: ['Rank', 'Province', 'Gold', 'Silver', 'Bronze', 'Total']

### Response:
SELECT MAX Total FROM table WHERE Silver < 40 AND Rank = 3