Here's a rough protocol that will probably work:
Accept input as a sequence of 6 digits in a string. Convert input string into a numerical value and save it. Separate input string into two separate strings based on given criteria. Convert each of the two strings into numerical values. Perform each calculation as needed in appropriate sequence. Compare calculated value with stored numerical value of original string.
Now take each sentence and expand on it one sentence at a time. Always checking your work as you go. If you get stuck post appropriate code, error messages, etc. If you don't know how to do one step or another try to look it up or ask appropriate question showing work so we know you've tried.