Sensor with Hex-string to dec value

I am struggling with the hex-string to dec value read from modbus

sensors:
- name: MFE P1 Grid frequency HEX
unique_id: mfe_p1_grid_frequency_hex
device_address: 6
address: 5036
input_type: holding
data_type: int16
scan_interval: 10
unit_of_measurement: Hz

I recive value 32,767 Hz wich is in HEX how can I convert it to dec so it will be 50,4Hz.