I scratched my head on this one for a while.
One could tackle this in many ways, but if we let FRY=f and HAM=h, then
we can whittle it down to something easier to solve.
Then we have:
. Divide through by 13.
Now, the ol' switcharoo.
I was amazed this actually worked.
I didn't see the very last part right away.
Because we can switch them around and have 538461 and 461538
your problem needs "nothing else" but counting. So I wrote a small program (see attachment) and the result popped up rather immediately. There isn't any mathematical thinking or deduction involved so I didn't dare to publish my "solution". so this post is only for the records.