Help My Brother Work on his Tan(gent)! This challenge is entirely fictional. There is no time limit for this challenge.
My little brother is terrible with computers! He saved up all of his money to buy a new one, and within half an hour the hard drive was wiped and the only software left is a lousy BF interpreter. The worst part of it is, he has a huge Geometry test tomorrow and needs help!
The Challenge
There's no way I'm going to let him touch my machine, so I'm going to need a fast way to write BF programs that solve his problem. He's learning about finding the area of regular polygons, and writing a new BF program for every calculation is a massive task. I need a fast way to generate BF programs! That's where you come in...
The Input
Your program or function will receive an integer 2 &lt; N &lt;= 100 which shall represent the number of sides of a regular polygon. You may receive input from function arguments, command line arguments, STDIN, or your language's closest alternative. If necessary, you may additionally require trailing or leading whitespace.
The Output
Your program should generate a separate BF program that takes input of a single positive integer 0 &lt; a &lt;= 10^10 that shall represent the length of the apothem of a regular polygon. When run, the BF program should output the area of a polygon with N sides and an apothem of a. More specifically:

Assume that the BF interpreter is set up such that , takes a number as input and . outputs a value as a number, not a character. An input of 12 does not translate to the characters '1' '2' in memory, rather the literal number 12. Similarly, when a value of 48 is output, it outputs '48', not the character '0'.
Assume also that each value on the tape of the BF program may contain an infinitely large integer -- the value will never wrap to 0.
Assume that the tape of the BF spans infinitely to the right, but has no negative indices. The pointer starts at 0.
My brother is as careless with numbers as he is with computers. As such, the BF code should output the area rounded to the nearest integer.

The Rules
In a separate and unrelated incident, my brother downloaded so much garbage onto my primary programming machine that I have virtually no hard drive space left. As such, your original program may not exceed 512 bytes.
Your score in this challenge is the length of all BF programs generated by your program for values of N from 3 to 100 inclusive.
Standard loopholes are disallowed.
Python, 23938 score

from math import*
def apothem(n):
 c=int(n*tan(pi/n)/2*10)

 s=',&gt;' + '+'*c
 m="&gt;[-]&gt;[-]&lt;&lt;[&gt;&gt;+&lt;&lt;-]&gt;&gt;[&lt;&lt;&lt;[&gt;+&gt;+&lt;&lt;-]&gt;&gt;[&lt;&lt;+&gt;&gt;-]&gt;-]&lt;&lt;"*2
 p="&gt;&gt;[-]&lt;[-]&lt;+++++&lt;[-]++++++++++"
 d="&gt;[&gt;+&lt;-]&gt;[&lt;&lt;[&gt;&gt;&gt;+&gt;+&lt;&lt;&lt;&lt;-]&gt;&gt;&gt;&gt;[&lt;&lt;&lt;&lt;+&gt;&gt;&gt;&gt;-]&lt;[&gt;+&lt;&lt;-[&gt;&gt;[-]&gt;+&lt;&lt;&lt;-]&gt;&gt;&gt;[&lt;&lt;&lt;+&gt;&gt;&gt;-]&lt;[&lt;-[&lt;&lt;-&gt;&gt;[-]]+&gt;-]&lt;-]&lt;&lt;+&gt;]"
 o="&lt;."
 print s+m+p+d+o



the area of a regular polygon is nsa/2 width n given in Python and a later in BF. s is the sidelength of the polygon, which can be computed from a and n
c is a constant, such that the area is (aac+5)/10, so only this formula must be coded into BF. c is between 15 and 25.
s is the starting point for the BF code: read the apothem and write c
m does c=ca twice, so in the cell formaly holding c there is aac
p prepares for the final operation, clearing temporary cells, adding 5 to aac and setting the first cell to 10
d division
o output


This is my first writing in BF, so all algorithms are from this page.