The content tree names are based on the page name - and in the page type settings only one field can be set as the source (sample screenshot). So, in this case you will need to add a separate field which will combine the two fields - e.g. a custom form control which will do the logic in the code and this field will be then set as the page name source field. Also, this field can be hidden on the editing form, so the editors will not be confused.
Another option would be using global event handler and in the before inster/update events you will read the values from the two fields and set them as the document name.