ChenDRAG/VeRL_math_validation huggingface dataset:
Problem: Princeton has an endowment of $5$ million dollars and wants to invest it into improving campus life. The university has three options: it can either invest in improving the dorms, campus parties or dining hall food quality. If they invest $a$ million dollars in the dorms, the students will spend an additional $5a$ hours per week studying. If the university invests $b$ million dollars in better food, the students will spend an additional $3b$ hours per week studying. Finally, if the $c$ million dollars are invested in parties, students will be more relaxed and spend $11c - c^2$ more hours per week studying. The university wants to invest its $5$ million dollars so that the students get as many additional hours of studying as possible. What is the maximal amount that students get to study?
Answer: 34
Problem: Triangle $ABC$ has side lengths $13$, $14$, and $15$. Let $E$ be the ellipse that encloses the smallest area which passes through $A, B$, and $C$. The area of $E$ is of the form $\frac{a \sqrt{b}\pi}{c}$ , where $a$ and $c$ are coprime and $b$ has no square factors. Find $a + b + c$.
Answer: 118
Problem: Billy the baker makes a bunch of loaves of bread every day, and sells them in bundles of size $1, 2$, or $3$. On one particular day, there are $375$ orders, $125$ for each bundle type. As such, Billy goes ahead and makes just enough loaves of bread to meet all the orders. Whenever Billy makes loaves, some get burned, and are not sellable. For nonnegative i less than or equal to the total number of loaves, the probability that exactly i loaves are sellable to customers is inversely proportional to $2^i$ (otherwise, it’s $0$). Once he makes the loaves, he distributes out all of the sellable loaves of bread to some subset of these customers (each of whom will only accept their desired bundle of bread), without worrying about the order in which he gives them out. If the expected number of ways Billy can distribute the bread is of the form $\frac{a^b}{2^c-1}$, find $a + b + c$.
Answer: 1011
Problem: $A_1A_2A_3A_4$ is a cyclic quadrilateral inscribed in circle $\Omega$, with side lengths $A_1A_2 = 28$, $A_2A_3 =12\sqrt3$, $A_3A_4 = 28\sqrt3$, and $A_4A_1 = 8$. Let $X$ be the intersection of $A_1A_3, A_2A_4$. Now, for $i = 1, 2, 3, 4$, let $\omega_i$ be the circle tangent to segments$ A_iX$, $A_{i+1}X$, and $\Omega$, where we take indices cyclically (mod $4$). Furthermore, for each $i$, say $\omega_i$ is tangent to $A_1A_3$ at $X_i $, $A_2A_4$ at $Y_i$ , and $\Omega$ at $T_i$ . Let $P_1$ be the intersection of $T_1X_1$ and $T_2X_2$, and $P_3$ the intersection of $T_3X_3$ and $T_4X_4$. Let $P_2$ be the intersection of $T_2Y_2$ and $T_3Y_3$, and $P_4$ the intersection of $T_1Y_1$ and $T_4Y_4$. Find the area of quadrilateral $P_1P_2P_3P_4$.
Answer: 784
Problem: We say that a string of digits from $0$ to $9$ is valid if the following conditions hold: First, for $2 \le k \le 4$, no consecutive run of $k$ digits sums to a multiple of $10$. Second, between any two $0$s, there are at least $3$ other digits. Find the last four digits of the number of valid strings of length $2020$.
Answer: 9040
Problem: Let $P$ be the power set of $\{1, 2, 3, 4\}$ (meaning the elements of P are the subsets of $\{1, 2, 3, 4\}$). How many subsets $S$ of $P$ are there such that no two distinct integers $a, b \in \{1, 2, 3, 4\}$ appear together in exactly one element of $S$?
Answer: 21056
Problem: Suppose that f is a function $f : R_{\ge 0} \to R$ so that for all $x, y \in R_{\ge 0}$ (nonnegative reals) we have that $$f(x)+f(y) = f(x+y+xy)+f(x)f(y).$$ Given that $f\left(\frac{3}{5} \right) = \frac12$ and$ f(1) = 3$, determine
$$\lfloor \log_2 (-f(10^{2021} - 1)) \rfloor.$$
Answer: 10104
Problem: Suppose that $p$ is the unique monic polynomial of minimal degree such that its coefficients are rational numbers and one of its roots is $\sin \frac{2\pi}{7} + \cos \frac{4\pi}{7}$. If $p(1) = \frac{a}{b}$, where $a, b$ are relatively prime integers, find $|a + b|$.
Answer: 57
Problem: Let $\gamma_1$ and $\gamma_2$ be circles centered at $O$ and $ P$ respectively, and externally tangent to each other at point $Q$. Draw point $D$ on $\gamma_1$ and point $E$ on $\gamma_2$ such that line $DE$ is tangent to both circles. If the length $OQ = 1$ and the area of the quadrilateral $ODEP$ is $520$, then what is the value of length $PQ$?
Answer: 64
Problem: Cary has six distinct coins in a jar. Occasionally, he takes out three of the coins and adds a dot to each of them. Determine the number of orders in which Cary can choose the coins so that, eventually, for each number $i \in \{0, 1, . . . , 5\}$, some coin has exactly $i$ dots on it.
Answer: 79200
Problem: Find the number of ordered pairs of integers $(x, y)$ such that $2167$ divides $3x^2 + 27y^2 + 2021$ with $0 \le x, y \le 2166$.
Answer: 2352
Problem: Let $N$ be the number of convex $27$-gons up to rotation there are such that each side has length $ 1$ and each angle is a multiple of $2\pi/81$. Find the remainder when $N$ is divided by $23$.
Answer: 12
Problem: Given integer $n$, let $W_n$ be the set of complex numbers of the form $re^{2qi\pi}$, where $q$ is a rational number so that $q_n \in Z$ and $r$ is a real number. Suppose that p is a polynomial of degree $ \ge 2$ such that there exists a non-constant function $f : W_n \to C$ so that $p(f(x))p(f(y)) = f(xy)$ for all $x, y \in W_n$. If $p$ is the unique monic polynomial of lowest degree for which such an $f$ exists for $n = 65$, find $p(10)$.
Answer: 100009
Problem: Let $C$ be a circle centered at point $O$, and let $P$ be a point in the interior of $C$. Let $Q$ be a point on the circumference of $C$ such that $PQ \perp OP$, and let $D$ be the circle with diameter $PQ$. Consider a circle tangent to $C$ whose circumference passes through point $P$. Let the curve $\Gamma$ be the locus of the centers of all such circles. If the area enclosed by $\Gamma$ is $1/100$ the area of $C$, then what is the ratio of the area of $C$ to the area of $D$?
Answer: 2500
Problem: Let $a_n$ be the number of unordered sets of three distinct bijections $f, g, h : \{1, 2, ..., n\} \to \{1, 2, ..., n\}$ such that the composition of any two of the bijections equals the third. What is the largest value in the sequence $a_1, a_2, ...$ which is less than $2021$?
Answer: 875
Problem: Let $f$ be defined as below for integers $n \ge 0$ and $a_0, a_1, ...$ such that $\sum_{i\ge 0}a_i$ is finite:
$$f(n; a_0, a_1, ...) = \begin{cases} a_{2020}, & \text{ $n = 0$} \\
\sum_{i\ge 0} a_i f(n-1;a_0,...,a_{i-1},a_i-1,a_{i+1}+1,a_{i+2},...)/ \sum_{i\ge 0}a_i & \text{$n > 0$} \end{cases}$$.
Find the nearest integer to $f(2020^2; 2020, 0, 0, ...)$.
Answer: 18
Problem: Let $P$ be a $10$-degree monic polynomial with roots $r_1, r_2, . . . , r_{10} \ne $ and let $Q$ be a $45$-degree monic polynomial with roots $\frac{1}{r_i}+\frac{1}{r_j}-\frac{1}{r_ir_j}$ where $i < j$ and $i, j \in \{1, ... , 10\}$. If $P(0) = Q(1) = 2$, then $\log_2 (|P(1)|)$ can be written as $a/b$ for relatively prime integers $a, b$. Find $a + b$.
Answer: 19
Problem: Let $ABCD$ be a cyclic quadrilateral with circumcenter $O$ and radius $10$. Let sides $AB$, $BC$, $CD$, and $DA$ have midpoints $M, N, P$, and $Q$, respectively. If $MP = NQ$ and $OM + OP = 16$, then what is the area of triangle $\vartriangle OAB$?
Answer: 78
Problem: We say that a positive integer $n$ is [i]divable [/i] if there exist positive integers $1 < a < b < n$ such that, if the base-$a$ representation of $n$ is $\sum_{i=0}^{k_1} a_ia^i$ , and the base-$b$ representation of $n$ is $\sum_{i=0}^{k_2}  b_ib^i$ , then for all positive integers $c > b$, we have that $\sum_{i=0}^{k_2}  b_ic^i$ divides $\sum_{i=0}^{k_1}  a_ic^i$. Find the number of non-divable $n$ such that $1 \le n \le  100$.
Answer: 27
Problem: Let there be a tiger, William, at the origin. William leaps $ 1$ unit in a random direction, then leaps $2$ units in a random direction, and so forth until he leaps $15$ units in a random direction to celebrate PUMaC’s 15th year.
There exists a circle centered at the origin such that the probability that William is contained in the circle (assume William is a point) is exactly $1/2$ after the $15$ leaps. The area of that circle can be written as $A\pi$. What is $A$?
Answer: 1240
Problem: Given a sequence $a_0, a_1, a_2, ... , a_n$, let its [i]arithmetic approximant[/i] be the arithmetic sequence $b_0, b_1, ... , b_n$ that minimizes the quantity $\sum_{i=0}^{n}(b_i -a_i)^2$, and denote this quantity the sequence’s anti-arithmeticity. Denote the number of integer sequences whose arithmetic approximant is the sequence $4$, $8$, $12$, $16$ and whose anti-arithmeticity is at most $20$.
Answer: 15
Problem: Let $f(x) =\frac{x+a}{x+b}$ satisfy $f(f(f(x))) = x$ for real numbers $a, b$. If the maximum value of a is $p/q$, where $p, q$ are relatively prime integers, what is $|p| + |q|$?
Answer: 7
Problem: Let $N$ be the number of sequences of positive integers greater than $ 1$ where the product of all of the terms of the sequence is $12^{64}$. If $N$ can be expressed as $a(2^b)$ ), where $a$ is an odd positive integer, determine $b$.
Answer: 128
Problem: Let $ABC$ be a triangle with sides $AB = 34$, $BC = 15$, $AC = 35$ and let $\Gamma$ be the circle of smallest possible radius passing through $A$ tangent to $BC$. Let the second intersections of $\Gamma$ and sides $AB$, $AC$ be the points $X, Y$ . Let the ray $XY$ intersect the circumcircle of the triangle $ABC$ at $Z$. If $AZ =\frac{p}{q}$ for relatively prime integers $p$ and $q$, find $p + q$.
Answer: 173
Problem: Let $\{x\} = x- \lfloor x \rfloor$ . Consider a function f from the set $\{1, 2, . . . , 2020\}$ to the half-open interval $[0, 1)$. Suppose that for all $x, y,$ there exists a $z$ so that $\{f(x) + f(y)\} = f(z)$. We say that a pair of integers $m, n$ is valid if $1 \le m, n \le 2020$ and there exists a function $f$ satisfying the above so $f(1) = \frac{m}{n}$. Determine the sum over all valid pairs $m, n$ of ${m}{n}$.
Answer: 1019595
Problem: Gary is baking cakes, one at a time. However, Gary’s not been having much success, and each failed cake will cause him to slowly lose his patience, until eventually he gives up. Initially, a failed cake has a probability of $0$ of making him give up. Each cake has a $1/2$ of turning out well, with each cake independent of every other cake. If two consecutive cakes turn out well, the probability resets to $0$ immediately after the second cake. On the other hand, if the cake fails, assuming that he doesn’t give up at this cake, his probability of breaking on the next failed cake goes from p to $p + 0.5$. If the expected number of successful cakes Gary will bake until he gives up is$ p/q$, for relatively prime $p, q$, find $p + q$.
Answer: 86
Problem: Let $\phi (x, u)$ be the smallest positive integer $n$ so that $2^u$ divides $x^n + 95$ if it exists, or $0$ if no such positive integer exists. Determine$ \sum_{i=0}^{255} \phi(i, 8)$.
Answer: 2704
Problem: Suppose we have a sequence $a_1, a2_, ...$ of positive real numbers so that for each positive integer $n$, we have that $\sum_{k=1}^{n} a_ka_{\lfloor \sqrt{k} \rfloor} = n^2$. Determine the first value of $k$ so $a_k > 100$.
Answer: 1018
Problem: Find the sum (in base $10$) of the three greatest numbers less than $1000_{10}$ that are palindromes in both base $10$ and base $5$.
Answer: 1584
Problem: Let $f(k)$ denote the number of triples $(a, b, c)$ of positive integers satisfying $a + b + c = 2020$ with $(k - 1)$ not dividing $a, k$ not dividing $b$, and $(k + 1)$ not dividing $c$. Find the product of all integers $k$ in the range 3 \le k \le 20 such that $(k + 1)$ divides $f(k)$.
Answer: 360
Problem: Three (not necessarily distinct) points in the plane which have integer coordinates between $ 1$ and $2020$, inclusive, are chosen uniformly at random. The probability that the area of the triangle with these three vertices is an integer is $a/b$ in lowest terms. If the three points are collinear, the area of the degenerate triangle is $0$. Find $a + b$.
Answer: 13
Problem: Let $X, Y$ , and $Z$ be concentric circles with radii $1$, $13$, and $22$, respectively. Draw points $A, B$, and $C$ on $X$, $Y$ , and $Z$, respectively, such that the area of triangle $ABC$ is as large as possible. If the area of the triangle is $\Delta$, find $\Delta^2$.
Answer: 24300
Problem: What is the smallest integer $a_0$ such that, for every positive integer $n$, there exists a sequence of positive integers $a_0, a_1, ..., a_{n-1}, a_n$ such that the first $n-1$ are all distinct, $a_0 = a_n$, and for $0 \le i \le n -1$, $a_i^{a_{i+1}}$ ends in the digits $\overline{0a_i}$ when expressed without leading zeros in base $10$.
Answer: 7
Problem: Last year, the U.S. House of Representatives passed a bill which would make Washington, D.C. into the $51$st state. Naturally, the mathematicians are upset that Congress won’t prioritize mathematical interest of flag design in choosing how many U.S. states there should be. Suppose the U.S. flag must contain, as it does now, stars arranged in rows alternating between $n$ and $n - 1$ stars, starting and ending with rows of n stars, where $n \ge 2$ is some integer and the flag has more than one row. What is the minimum number of states that the U.S. would need to contain so that there are at least three different ways, excluding rotations, to arrange the stars on the flag?
Answer: 53
Problem: Given two positive integers $a \ne b$, let $f(a, b)$ be the smallest integer that divides exactly one of $a, b$, but not both. Determine the number of pairs of positive integers $(x, y)$, where $x \ne y$, $1\le x, y, \le 100$ and $\gcd(f(x, y), \gcd(x, y)) = 2$.
Answer: 706
Problem: You are walking along a road of constant width with sidewalks on each side. You can only walk on the sidewalks or cross the road perpendicular to the sidewalk. Coming up on a turn, you realize that you are on the “outside” of the turn; i.e., you are taking the longer way around the turn. The turn is a circular arc. Assuming that your destination is on the same side of the road as you are currently, let $\theta$ be the smallest turn angle, in radians, that would justify crossing the road and then crossing back after the turn to take the shorter total path to your destination. What is $\lfloor 100 \cdot \theta \rfloor$ ?
Answer: 200
Problem: How many ordered triples of nonzero integers $(a, b, c)$ satisfy $2abc = a + b + c + 4$?
Answer: 6
Problem: Will and Lucas are playing a game. Will claims that he has a polynomial $f$ with integer coefficients in mind, but Lucas doesn’t believe him. To see if Will is lying, Lucas asks him on minute $i$ for the value of $f(i)$, starting from minute $ 1$. If Will is telling the truth, he will report $f(i)$. Otherwise, he will randomly and uniformly pick a positive integer from the range $[1,(i+1)!]$. Now, Lucas is able to tell whether or not the values that Will has given are possible immediately, and will call out Will if this occurs. If Will is lying, say the probability that Will makes it to round $20$ is $a/b$. If the prime factorization of $b$ is $p_1^{e_1}... p_k^{e_k}$ , determine the sum $\sum_{i=1}^{k} e_i$.
Answer: 289
Problem: Find the number of points $P \in Z^2$ that satisfy the following two conditions:
1) If $Q$ is a point on the circle of radius $\sqrt{2020}$ centered at the origin such that the line $PQ$ is tangent to the circle at $Q$, then $PQ$ has integral length.
2) The x-coordinate of $P$ is $38$.
Answer: 16
Problem: Jacob has a piece of bread shaped like a figure $8$, marked into sections and all initially connected as one piece of bread. The central part of the “$8$” is a single section, and each of the two loops of “$8$” is divided into an additional $1010$ pieces. For each section, there is a $50$ percent chance that Jacob will decide to cut it out and give it to a friend, and this is done independently for each section. The remaining sections of bread form some number of connected pieces. If $E$ is the expected number of these pieces, and $k$ is the smallest positive integer so that $2^k(E - \lfloor E \rfloor ) \ge 1$, find $\lfloor E \rfloor +k$. (Here, we say that if Jacob donates all pieces, there are $0$ pieces left).
Answer: 1515
Problem: Let $C$ denote the curve $y^2 =\frac{x(x+1)(2x+1)}{6}$. The points $(1/2, a)$,$(b, c)$, and $(24, d)$ lie on $C$ and are collinear, and $ad < 0$. Given that $b, c$ are rational numbers, find $100b^2 + c^2$.
Answer: 101
Problem: Katie has a chocolate bar that is a $5$-by-$5$ grid of square pieces, but she only wants to eat the center piece. To get to it, she performs the following operations:
i. Take a gridline on the chocolate bar, and split the bar along the line.
ii. Remove the piece that doesn’t contain the center.
iii. With the remaining bar, repeat steps $1$ and $2$.
Determine the number of ways that Katie can perform this sequence of operations so that eventually she ends up with just the center piece.
Answer: 6384
Problem: Consider a regular $2020$-gon circumscribed into a circle of radius $ 1$. Given three vertices of this polygon such that they form an isosceles triangle, let $X$ be the expected area of the isosceles triangle they create. $X$ can be written as $\frac{1}{m \tan((2\pi)/n)}$ where $m$ and $n$ are integers. Compute $m + n$.
Answer: 5049
Problem: Hexagon $ABCDEF$ has an inscribed circle $\Omega$ that is tangent to each of its sides. If $AB = 12$, $\angle FAB = 120^o$, and $\angle ABC = 150^o$, and if the radius of $\Omega$  can be written as $m +\sqrt{n}$ for positive integers $m, n$, find $m + n$.
Answer: 36
Problem: Consider a $2021$-by-$2021$ board of unit squares. For some integer $k$, we say the board is tiled by $k$-by-$k$ squares if it is completely covered by (possibly overlapping) $k$-by-$k$ squares with their corners on the corners of the unit squares. What is the largest integer k such that the minimum number of $k$-by-$k$ squares needed to tile the $2021$-by-$2021$ board is exactly equal to $100$?
Answer: 224
Problem: Runey is speaking his made-up language, Runese, that consists only of the “letters” zap, zep, zip, zop, and zup. Words in Runese consist of anywhere between $1$ and $5$ letters, inclusive. As well, Runey can choose to add emphasis on any letter(s) that he chooses in a given word, hence making it a totally distinct word! What is the maximum number of possible words in Runese?
Answer: 111110
Problem: Heron is going to watch a show with $n$ episodes which are released one each day. Heron wants to watch the first and last episodes on the days they first air, and he doesn’t want to have two days in a row that he watches no episodes. He can watch as many episodes as he wants in a day. Denote by $f(n)$ the number of ways Heron can choose how many episodes he watches each day satisfying these constraints. Let $N$ be the $2021$st smallest value of $n$ where $f(n) \equiv 2$ mod $3$. Find $N$.
Answer: 265386
Problem: There are n lilypads in a row labeled $1, 2, \dots, n$ from left to right. Fareniss the Frog picks a lilypad at random to start on, and every second she jumps to an adjacent lilypad; if there are two such lilypads, she is twice as likely to jump to the right as to the left. After some finite number of seconds, there exists two lilypads $A$ and $B$ such that Fareniss is more than $1000$ times as likely to be on $A$ as she is to be on $B$. What is the minimal number of lilypads $n$ such that this situation must occur?
Answer: 12
Problem: We say that a polynomial $p$ is respectful if $\forall x, y \in Z$, $y - x$ divides $p(y) - p(x)$, and $\forall x \in Z$, $p(x)  \in Z$. We say that a respectful polynomial is disguising if it is nonzero, and all of its non-zero coefficients lie between $0$ and $ 1$, exclusive. Determine $\sum deg(f)\cdot  f(2)$, where the sum includes all disguising polynomials $f$ of degree at most $5$.
Answer: 290
Problem: Select two distinct diagonals at random from a regular octagon. What is the probability that the two diagonals intersect at a point strictly within the octagon? Express your answer as $a + b$, where the probability is $\tfrac{a}{b}$ and $a$ and $b$ are relatively prime positive integers.
Answer: 26
Problem: Suppose that $f : Z\times Z \to R$, satisfies the equation $f(x, y) = f(3x+y, 2x+ 2y)$ for all $x, y \in Z$. Determine the maximal number of distinct values of $f(x, y)$ for $1 \le x, y \le  100$.
Answer: 8983
Problem: Let $f(n) = \sum_{gcd(k,n)=1,1\le k\le n}k^3$ . If the prime factorization of $f(2020)$ can be written as $p^{e_1}_1 p^{e_2}_2 ... p^{e_k}_k$, find $\sum^k_{i=1} p_ie_i$.
Answer: 818
Problem: Let $f$ be a polynomial. We say that a complex number $p$ is a double attractor if there exists a polynomial $h(x)$ so that $f(x)-f(p) = h(x)(x-p)^2$ for all x \in R. Now, consider the polynomial $$f(x) = 12x^5 - 15x^4 - 40x^3 + 540x^2 - 2160x + 1,$$ and suppose that it’s double attractors are $a_1, a_2, ... , a_n$. If the sum $\sum^{n}_{i=1}|a_i|$ can be written as $\sqrt{a} +\sqrt{b}$, where $a, b$ are positive integers, find $a + b$.
Answer: 49
Problem: A [i]substring [/i] of a number $n$ is a number formed by removing some digits from the beginning and end of $n$ (possibly a different number of digits is removed from each side). Find the sum of all prime numbers $p$ that have the property that any substring of $p$ is also prime.
Answer: 576
Problem: $ABC$ is a triangle where $AB = 10$, $BC = 14$, and $AC = 16$. Let $DEF$ be the triangle with smallest area so that $DE$ is parallel to $AB$, $EF$ is parallel to $BC$, $DF$ is parallel to $AC$, and the circumcircle of $ABC$ is $DEF$’s inscribed circle. Line $DA$ meets the circumcircle of $ABC$ again at a point $X$. Find $AX^2$
.
Answer: 196
Problem: A nonempty word is called pronounceable if it alternates in vowels (A, E, I, O, U) and consonants (all other letters) and it has at least one vowel. How many pronounceable words can be formed using the letters P, U, M, A, C at most once each? Words of length shorter than $5$ are allowed.
Answer: 68
Problem: Compute the sum of all real numbers x which satisfy the following equation $$\frac {8^x - 19 \cdot 4^x}{16 - 25 \cdot 2^x}= 2$$
Answer: 5
Problem: Given a positive integer $n$ with prime factorization $p_1^{e_1}p_2^{e_2}... p_k^{e_k}$ , we define $f(n)$ to be  $\sum^k_{i=1}p_ie_i$. In other words, $f(n)$ is the sum of the prime divisors of $n$, counted with multiplicities. Let $M$ be the largest odd integer such that $f(M) = 2023$, and $m$ the smallest odd integer so that $f(m) = 2023$. Suppose that $\frac{M}{m}$ equals $p_1^{e_1}p_2^{e_2}... p_l^{e_l}$ , where the $e_i$ are all nonzero integers and the $p_i$ are primes. Find $\left| \sum^l_{i=1} (p_i + e_i) \right|$.
Answer: 2695
Problem: Determine the number of pairs $(a, b)$, where $1 \le a \le b \le 100$ are positive integers, so that $\frac{a^3+b^3}{a^2+b^2}$ is an integer.
Answer: 122
Problem: Compute the number of ordered pairs of non-negative integers $(x, y)$ which satisfy $x^2 + y^2 = 32045.$
Answer: 16
Problem: Let $f(n) = \sum^n_{i=1}\frac{gcd(i,n)}{n}$. Find the sum of all positive integers $ n$ for which $f(n) = 6$.
Answer: 1192
Problem: The roots of the polynomial $f(x) = x^8 +x^7 -x^5 -x^4 -x^3 +x+ 1 $ are all roots of unity. We say that a real number $r \in [0, 1)$ is nice if $e^{2i \pi r} = \cos 2\pi r + i \sin 2\pi r$ is a root of the polynomial $f$ and if $e^{2i \pi r}$  has positive imaginary part. Let $S$ be the sum of the values of nice real numbers $r$. If $S =\frac{p}{q}$  for relatively prime positive integers $p, q$, find $p + q$.
Answer: 31
Problem: Nelson is having his friend drop his unique bouncy ball from a $12$ foot building, and Nelson will only catch the ball at the peak of its trajectory between bounces. On any given bounce, there is an $80\%$ chance that the next peak occurs at $\frac13$ the height of the previous peak and a $20\%$ chance that the next peak occurs at $3$ times the height of the previous peak (where the first peak is at $12$ feet). If Nelson can only reach $4$ feet into the air and will catch the ball as soon as possible, the probability that Nelson catches the ball after exactly $13$ bounces is $2^a \times 3^b  \times 5^c  \times 7^d  \times 11^e$ for integers $a, b, c, d$, and $e$. Find $|a| + |b| + |c| + |d| + |e|$.
Answer: 31