// -*- mode: java -*-
// $Id: nestedloop.njs,v 1.1 2001/07/08 20:20:06 doug Exp $
// http://www.bagley.org/~doug/shootout/
// From David Hedbor
// modified by Aldo Calpini <dada@perl.it> for Win32

var n, x=0;

ARGS = WScript.Arguments;

if(ARGS.length > 0) {
  n = parseInt(ARGS.Item(0), "10");
  if(n < 1) n = 1;
} else {
  n = 1;
}
var a=n;
// Using while() is faster than for()
while(a--) {
  var b=n; while(b--) {
    var c=n; while(c--) {
      var d=n; while(d--) {
    var e=n; while(e--) {
      var f=n; while(f--) {
        x++;
      }
    }
      }
    }
  }
}
WScript.Echo(x);