The mode you have entered is used exclusively for flashing the firmware using a special tool on PC. This can be dangerous and if it's done incorrectly, you can "brick" your phone. Simply restart the phone and remove the stylus, then press the combination you have previously used. The phone will enter Recovery Mode. Select Wipe Data/Factory reset using volume buttons then select with Power Button. The phone will restart its default settings and it will not hang anymore. This was caused by a bad application which was not compatible with your phone.