Alternate every 3 items and 4 items

I have a number of items in an array, say more than 14 items.

How can I group them into 2 different groups in this manner: The first 3 (#1,2,3) will be in array A, next 4 (#4,5,6,7) will be in array B, next 3 (#8,9,10) will be in array A, next 4 (#11,12,13,14) will be in array B and so on.

I tried using modulos, but half way through I realized that numbers with factors of 3 and 4 will not be able to be differentiated by using modulos.

I'm using Javascript/PHP for this, but any similar language is fine

I would pair a modulus-7 with a less-than-3 check... something like this (php):

for($i = 0; $i < count($array); $i++) {
  if($i%7 < 3) {
    $sortA[] = $array[$i];
  } else {
    $sortB[] = $array[$i];
  }
}

For JavaScript:

var array1 = [];
var array2 = [];
for (var i=0; i< input.length; i++) {
    if (i % 7 < 3) 
        array1.push(input[i]);
    else
        array2.push(input[i]);
}