!if $taal=nl
    nivo_title=Bereken de breuken som.
    somtekst1=Reken de volgende som uit<br>\
    en vereenvoudig de uitkomst zo ver mogelijk:<br>\
    <em><small>pas op, de uitkomsten kunnen negatief zijn</small></em>
!else
    nivo_title=Calculate the fractions.
    somtekst1=Calculate the fractions<br>\
    and reduce the outcome as far as you can.<br>\
    <em><small>also negative end-results are possible</small></em>
!endif
bewerking=bewerking1.proc
    
!if $negatief=0
    lijst_a=!shuffle 1,2,3,4,1,2,3,4
    lijst_b=!shuffle 4,5,6,7,4,5,6,7
    lijst_c=!shuffle 1,2,3,4,1,2,3,4
    lijst_d=!shuffle 5,6,7,8,9,9,8,7,6,5
!else
    lijst_a=!shuffle 1,2,3,4,5,6,-1,-2,-3,-4,-5,-6
    lijst_b=!shuffle 4,5,6,7,8,9,10,-4,-5,-6,-7,-8,-9,-10
    lijst_c=!shuffle 2,3,4,-2,-3,-4
    lijst_d=!shuffle 7,8,9,10,11,12,13,15,-7,-8,-9,-10,-11,-12,-13,-15
!endif
    
totaal=$empty
R=$graad
!for n=1 to $aantal_sommen
    keuze=!randitem 1,2,3
    !if $keuze=1
	pm=+
	mp=-
    !else
	!if $keuze=2
	    pm=-
    	    mp=+
	!else
	    pm=-
	    mp=-
	!endif
    !endif
    !if $graad=0
	R=$n
    !endif
    !if $R=1
	b=!randitem 2,3,4,5,6,7,8,9
	d=$b
	f=$b
	a=$[2*$n]
	c=!item $n of $lijst_c
	e=$n
    !endif
    !if $R=2
	b=!randitem 2,3,4,5,6,7,8
	d=$[2*$b]
	f=!randitem $b,$d
	c=!item $n of $lijst_c
	a=$n
	e=!item $n of $lijst_d
    !endif
    !if $R>2
	a=!item $n of $lijst_a
	b=!item $n of $lijst_b
	c=!item $n of $lijst_c
	d=!item $n of $lijst_d	
	e=$n
	f=!item $[$n+1] of $lijst_d
    !endif
    	
    som$n=($a)/($b) $pm ($c)/($d) $mp ($e)/($f) 
    opgave$n=\frac{$a}{$b} $pm \frac{$c}{$d} $mp \frac{$e}{$f}
    totaal=!append line $(som$n) to $totaal
    totaal=!append line printtex($(som$n)) to $totaal 
!next n

totaal=!exec pari $totaal

i=1
!for n=1 to $aantal_sommen
    GOED$n=!line $i of $totaal
    goed$n=!line $[$i+1] of $totaal
    i=$[$i+2]	 
!next n
