I need to find a generalized equation for this problem:

Given the digits 1, 3, 6 and 9, find the probability that a 4-digit number is formed by using each of them only once and is divisible 7.

I found that there are 24 numbers and 4 are divisible by 7 for those specific digits but when I go to generalize this (and attempt to write an equation) I am lost. I did this via a tree diagram but cannot solve to get a general equation, ie, if 4 random digits are picked, and arranged to make a 4 digit number, what is the probabilty that they are divisible by 7 (there has to be an equation where you can plug in 4 numbers and do get the probability)?

I am lost and need help desperately as this is due in a few days. A push in the right direction PLZ!! thnx!!