To answer your question directly, generally speaking, defaulting on your mortgage tends to be more severe of a negative impact on your credit compared to defaulting on your credit cards. Typically, it is advisable that if you had to pick and choose which one to pay, the preference should be the mortgage. However, if you can't can't afford to pay the mortgage, even if you have stopped paying the credit cards, then doing a loan modification is would be the next logical step. Unfortunately, you have tried that route with no success. I recommend taking a look at the Making Homes Affordable web site to see if there are any other alternative ways to modifying your home mortgage.
If you still run into the problem that the lender will not modify your mortgage because of the amount of unsecured debt you have. I recommend that you take a look at the different debt consolidation options to see if that will help you qualify. Normally when you consolidate your debt you tend to lower your overall monthly payments. This may put you in a better position to qualify for a modification. Please also review all of your debt relief options.
If you still are unable to qualify for a modification you may want to consider doing a short sale. To learn more about the differences between a short sale, deed in lieu, and foreclosure please read an article I wrote A Deed In Lieu Of Foreclosure vs. A Short Sale.
Ultimately, there is no simple solution to this situation, and if you find that none of these routes work out for you, I encourage you to speak with a licensed bankruptcy attorney in your state.
I hope this information helps you Find, Learn. Save.