!if $taal=nl
    nivo_title=Optellen van breuken.
    somtekst1=Tel de volgende breuken bij elkaar op<br>\
    en vereenvoudig de uitkomst zo ver mogelijk:<br>
!else
    nivo_title=Addition of Fractions
    somtekst1=Add up the fractions<br>and reduce the outcome:<br>
!endif
bewerking=bewerking1.proc
    
!if $negatief=0
    lijst_a=!shuffle 1,2,3,4,5,6,7,8
    lijst_b=!shuffle 4,5,6,7,8,9,10
    lijst_c=!shuffle 2,3,4,5,6,7,8
    lijst_d=!shuffle 7,8,9,10,11,12,13,15
    pm=1
    mp=1
!else
    lijst_a=!shuffle 2,3,4,5,6,-1,-2,-3,-4,-5,-6
    lijst_b=!shuffle 4,5,6,7,8,9,10
    lijst_c=!shuffle 2,3,4,-1,-2,-3,-4,-5
    lijst_d=!shuffle 7,8,9,10,11,12,13,15
    pm=!randitem 1,-1
    mp=!randitem 1,-1
!endif
    
totaal=$empty
R=$graad
!for n=1 to $aantal_sommen
	!if $graad=0
	    R=$n
	!endif
	!if $R=1
	    b=!randitem 5,6,7,8,9,10,11,12,13,14
	    d=$b
	    a=!item $n of $lijst_a 
	    c=!item $n of $lijst_c
	!endif    
	!if $R=2
	    b=!randitem 6,7,8,9,10,12,14
	    d=!randitem $[2*$b],$[3*$b],$[4*$b]
	    a=!item $n of $lijst_a
	    c=!item $n of $lijst_c
	!endif    
	!if $R=3
    	    a=!item $n of $lijst_a
	    b=!item $n of $lijst_b
            c=!item $n of $lijst_c
            d=!item $n of $lijst_d	
	!endif    
	!if $R>3
    	    a=!item $n of $lijst_a
	    b=!item $n of $lijst_b
	    b=$[$pm*$b]
            c=!item $n of $lijst_c
            d=!item $n of $lijst_d
	    d=$[$mp*$d]	
	!endif    
    som$n=($a)/($b) + ($c)/($d)
    opgave$n=\frac{$a}{$b} + \frac{$c}{$d}
    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
