How do I set the values of several variables in a simple algebraic method relating to each other in Javascript?

I am trying to make a program to procedurally generate a circular language. I already crafted the letters and am going to hardcode them after I set up the foundations. I have an issue where I cannot manage to get three variables to change based on a simple algebraic equation. I want the long length to be thrice the length of the small, and the medium twice the length of the small.

The way I wanted to do it was a long the lines of this(yes 270 is the full rotation, the code is a little wacky, don’t judge);

270=(3*longLength*longCount)+(2*mediumLength*mediumCount)+(shortLength*shortCount);

which doesn’t work for various reasons, but the point is that I need the length vars to be defined such that they are 1:2:3 ratio, and when you add the lengths of every character it reaches 270. right now I am using a variant of that code,

//def vars
var shortLength;
var mediumLength;
var longLength;
var shortCount=0;
var mediumCount=0;
var longCount=0;
//I have a counting and input function that works, that's all that needs to be said there, assume that the Values of the counts are neither identically valued, nor at 0
if (totalCount>1){
    shortLength=((-3*longLength*longCount)+(-2*mediumLength*mediumCount)+270)/shortCount;
} else {
    shortLength=270;
    mediumLength=270;
    longLength=270;
}

which is scuffed and does not work at all as expected.