function division(a, b, decim, periode, larg, str) {
	var sa= new String(a), sb= new String(b), l = sa.length, t=sb.length;
//print(sa)
//print(sb)
	var s0 = sa;
	var q,r,c, quotient = "";
	var test, p, u;
	for( test=true,p=0, u=0; test==true ; p++) {
		c=((p<l)? parseInt(sa.charAt(p)) : 0)
		u = 10*u + c
		r = u%b;
		q = (u-r)/b
		u=r;
		if(p==l) quotient += "."
		if(p==l+decim) quotient += "["
		if(quotient!="" || q !=0)
			quotient += q
		if(p==l+decim+periode-1) {
			quotient += "]"
			test = false
		}
	}
	if(quotient.charAt(0)==".") {
		quotient = "0"+quotient
	}
	quotient = str+quotient
	return decoupe(quotient, larg)
}

var decoupe = function(s, k) {
	var st=""
	for(var i=0; i<s.length; i+=k) {
		st += s.substr(i, k)+"\n"
	}
	return st
}
/*
var s = division(131002,203385,1,444,80,"p/q=")

print(s)
*/

