Navvye/Olympiad-Problems-CSV huggingface dataset:
Problem: A hexagon that is inscribed in a circle has side lengths $22$ $22$ $20$ $22$ $22$ , and $20$ in that order. The radius of the circle can be written as $p+\sqrt{q}$ , where $p$ and $q$ are positive integers. Find $p+q$

Solution: [asy] import olympiad; import math;  real a; a=2*asin(11/(5+sqrt(267))); pair A,B,C,D,E,F; A=expi(pi); B=expi(pi-a); C=expi(a); D=expi(0); E=expi(-a); F=expi(pi+a); draw(A--B--C--D--E--F--A--D); draw(B--D); draw(A--C); dot(A); dot(B); dot(C); dot(D); dot(E); dot(F); draw(unitcircle); label("$A$",A,W);label("$B$",B,NW);label("$C$",C,NE);label("$D$",D,dir(0));label("$E$",E,SE);label("$F$",F,SW);  [/asy]
We know that $AD=x$ is a diameter, hence $ABD$ and $ACD$ are right triangles. Let $AB=BC=22$ , and $CD=20.$ Hence, $ABD$ is a right triangle with legs $22,\sqrt{x^2-484},$ and hypotenuse, $x,$ and $ACD$ is a right triangle with legs $20, \sqrt{x^2-400},$ with hypotenuse $x$ . By Ptolemy's we have \[22(x+20)=\sqrt{x^2-400}\sqrt{x^2-484}\] .
We square both sides to get \[484(x+20)^2=(x^2-400)(x^2-484) \implies 484(x+20)=(x-20)(x^2-484) \implies 484x=x^3-20x^2-484x \implies x(x^2-20x-968)=0\]
We solve for $x$ via the Quadratic Formula and receive $x=10+2\sqrt{267}$ , but we must divide by $2$ since we want the radius, and hence $267+5=\boxed{272}.$ ~SirAppel

Answer:  272
Problem: $7\times 1$ board is completely covered by $m\times 1$ tiles without overlap; each tile may cover any number of consecutive squares, and each tile lies completely on the board. Each tile is either red, blue, or green. Let $N$ be the number of tilings of the $7\times 1$ board in which all three colors are used at least once. For example, a $1\times 1$ red tile followed by a $2\times 1$ green tile, a $1\times 1$ green tile, a $2\times 1$ blue tile, and a $1\times 1$ green tile is a valid tiling. Note that if the $2\times 1$ blue tile is replaced by two $1\times 1$ blue tiles, this results in a different tiling. Find the remainder when $N$ is divided by $1000$

Solution: Firstly, we consider how many different ways possible to divide the $7\times 1$ board.
We ignore the cases of 1 or 2 pieces since we need at least one tile of each color.
Secondly, we use Principle of Inclusion-Exclusion to consider how many ways to color them:
Finally, we combine them together: $15\times 6+20\times 36+15\times 150+6\times 540+1\times 1806= 8106$
So the answer is $\boxed{106}$

Answer:  106
Problem: $7\times 1$ board is completely covered by $m\times 1$ tiles without overlap; each tile may cover any number of consecutive squares, and each tile lies completely on the board. Each tile is either red, blue, or green. Let $N$ be the number of tilings of the $7\times 1$ board in which all three colors are used at least once. For example, a $1\times 1$ red tile followed by a $2\times 1$ green tile, a $1\times 1$ green tile, a $2\times 1$ blue tile, and a $1\times 1$ green tile is a valid tiling. Note that if the $2\times 1$ blue tile is replaced by two $1\times 1$ blue tiles, this results in a different tiling. Find the remainder when $N$ is divided by $1000$

Solution: This solution is basically solution 1 with more things done at once. The game plan:
$\sum_{i=0}^{7} ($ the amount of ways to divide the board into $i$ pieces $) \cdot ($ the amount of ways to color the respective divisions)
The amount of ways to divide the board is determined using stars and bars. The colorings are found using PIE giving $3^i-3\cdot2^i+3$ . Plus, we don't have to worry about the cases where $i=1$ or $I=2$ since they both give no solutions. So our equation becomes:
$\sum_{i=3}^{7} \left(\dbinom{6}{I}\right)\cdot\left(3^i-3\cdot2^i+3\right)$
Writing it all out and keeping the numbers small with mod 1000, we will eventually arrive at the answer of $\boxed{106}$

Answer:  106
Problem: $7\times 1$ board is completely covered by $m\times 1$ tiles without overlap; each tile may cover any number of consecutive squares, and each tile lies completely on the board. Each tile is either red, blue, or green. Let $N$ be the number of tilings of the $7\times 1$ board in which all three colors are used at least once. For example, a $1\times 1$ red tile followed by a $2\times 1$ green tile, a $1\times 1$ green tile, a $2\times 1$ blue tile, and a $1\times 1$ green tile is a valid tiling. Note that if the $2\times 1$ blue tile is replaced by two $1\times 1$ blue tiles, this results in a different tiling. Find the remainder when $N$ is divided by $1000$

Solution: 3 colors is a lot. How many ways can we tile an $n \times 1$ board with one color? It's going to be $2^{n-1}$ because if you draw out the $n$ spaces, you can decide whether each of the borders between the tiles are either there or not there. There are $n-1$ borders so there are $2^{n-1}$ tilings. Define a one-tiling of an mx1 as $f_1(m)$
Now let's look at two colors. Let's see if we can get a two-tiling of an $(n+1) \times 1$ based off a $n \times 1$ . There are 2 cases we should consider:
1) The $n \times 1$ was a one-coloring and the block we are going to add consists of the second color. The number of ways we can do this is $2f_1(n)$
2) The $n \times 1$ was a two-color tiling so now we've got 3 cases to form the $(n+1) \times 1$ : We can either add a block of the first color, the second color, or we can adjoin a block to the last block in the $n \times 1$
This gives us $f_2(n+1)=2f_1(n)+3f_2(n)$
Time to tackle the 3-color tiling. Again, we split into 2 cases:
1) The $n \times 1$ was a two-color tiling, and the block we are adding is of the 3rd color. This gives $f_2(n)$ ways but we have to multiply by $3C2 = 3$ because we have to pick 2 different colors for the two-color tiling.
2) The $n \times 1$ was a 3-color tiling, and we have to consider what we can do with the block that we are adding. It can be any of the 3 colors, or we can adjoin it to whatever was the last block in the $n \times 1$ . This gives $4f_3(n)$
So in total we have $f_3(n+1)=3f_2(n)+4f_3(n)$
Finally, we just sorta bash through the computation to get $f_3(7)=8\boxed{106}$

Answer:  106
Problem: $7\times 1$ board is completely covered by $m\times 1$ tiles without overlap; each tile may cover any number of consecutive squares, and each tile lies completely on the board. Each tile is either red, blue, or green. Let $N$ be the number of tilings of the $7\times 1$ board in which all three colors are used at least once. For example, a $1\times 1$ red tile followed by a $2\times 1$ green tile, a $1\times 1$ green tile, a $2\times 1$ blue tile, and a $1\times 1$ green tile is a valid tiling. Note that if the $2\times 1$ blue tile is replaced by two $1\times 1$ blue tiles, this results in a different tiling. Find the remainder when $N$ is divided by $1000$

Solution: Let $n$ be the length of the board and $x$ be the number of colors. We will find the number of ways to tile the $n \times 1$ board with no color restrictions (some colors may be unused) and then use PIE.
By stars and bars, the number of ways to divide the board into $k$ pieces is ${n-1 \choose k-1}$ . There are $x^k$ ways to color each of these divisions. Therefore, the total number of ways to divide and color the board is \begin{align*} \chi(n, x) &:= \sum_{k=1}^n {n-1 \choose k-1} x^k \\ &= x\sum_{k=0}^{n-1} {n-1 \choose k} x^k \\ &= x(x+1)^{n-1}. \end{align*}
In the given problem, we have $n=7$ . By PIE, we have \begin{align*} &\quad {3 \choose 3} \chi(7, 3) - {3 \choose 2} \, \chi(7, 2) + {3 \choose 1} \, \chi(7, 1) \\ &= 3 \cdot 4^6 - 3(2 \cdot 3^6) + 3(1 \cdot 2^6) \\ &= 8106 \rightarrow \boxed{106}

Answer:  106
Problem: Given a circle of radius $\sqrt{13}$ , let $A$ be a point at a distance $4 + \sqrt{13}$ from the center $O$ of the circle. Let $B$ be the point on the circle nearest to point $A$ . A line passing through the point $A$ intersects the circle at points $K$ and $L$ . The maximum possible area for $\triangle BKL$ can be written in the form $\frac{a - b\sqrt{c}}{d}$ , where $a$ $b$ $c$ , and $d$ are positive integers, $a$ and $d$ are relatively prime, and $c$ is not divisible by the square of any prime. Find $a+b+c+d$

Solution: [asy] import math; import olympiad; import graph; pair A, B, K, L; B = (sqrt(13), 0); A=(4+sqrt(13), 0); dot(B); dot(A);  draw(Circle((0,0), sqrt(13))); label("$O$", (0,0), S);label("$B$", B, SW);label("$A$", A, S); dot((0,0));    [/asy]
Now we put the figure in the Cartesian plane, let the center of the circle $O (0,0)$ , then $B (\sqrt{13},0)$ , and $A(4+\sqrt{13},0)$
The equation for Circle O is $x^2+y^2=13$ , and let the slope of the line $AKL$ be $k$ , then the equation for line $AKL$ is $y=k(x-4-\sqrt{13})$
Then we get $(k^2+1)x^2-2k^2(4+\sqrt{13})x+k^2\cdot (4+\sqrt{13})^2-13=0$ . According to Vieta's Formulas , we get
$x_1+x_2=\frac{2k^2(4+\sqrt{13})}{k^2+1}$ , and $x_1x_2=\frac{(4+\sqrt{13})^2\cdot k^2-13}{k^2+1}$
So, $LK=\sqrt{1+k^2}\cdot \sqrt{(x_1+x_2)^2-4x_1x_2}$
Also, the distance between $B$ and $LK$ is $\frac{k\times \sqrt{13}-(4+\sqrt{13})\cdot k}{\sqrt{1+k^2}}=\frac{-4k}{\sqrt{1+k^2}}$
So the area $S=0.5ah=\frac{-4k\sqrt{(16+8\sqrt{13})k^2-13}}{k^2+1}$
Then the maximum value of $S$ is $\frac{104-26\sqrt{13}}{3}$
So the answer is $104+26+13+3=\boxed{146}$

Answer:  146
Problem: Given a circle of radius $\sqrt{13}$ , let $A$ be a point at a distance $4 + \sqrt{13}$ from the center $O$ of the circle. Let $B$ be the point on the circle nearest to point $A$ . A line passing through the point $A$ intersects the circle at points $K$ and $L$ . The maximum possible area for $\triangle BKL$ can be written in the form $\frac{a - b\sqrt{c}}{d}$ , where $a$ $b$ $c$ , and $d$ are positive integers, $a$ and $d$ are relatively prime, and $c$ is not divisible by the square of any prime. Find $a+b+c+d$

Solution: [asy] import math; import olympiad; import graph; pair A, B, K, L; B = (sqrt(13), 0); A=(4+sqrt(13), 0); dot(B); dot(A);  draw(Circle((0,0), sqrt(13))); label("$O$", (0,0), S);label("$B$", B, SW);label("$A$", A, S); dot((0,0));    [/asy]
Draw $OC$ perpendicular to $KL$ at $C$ . Draw $BD$ perpendicular to $KL$ at $D$
\[\frac{\triangle OKL}{\triangle BKL} = \frac{OC}{BD} = \frac{AO}{AB} = \frac{4+\sqrt{13}}{4}\]
Therefore, to maximize area of $\triangle BKL$ , we need to maximize area of $\triangle OKL$
\[\triangle OKL = \frac12 r^2 \sin{\angle KOL}\]
So when area of $\triangle OKL$ is maximized, $\angle KOL = \frac{\pi}{2}$
Eventually, we get \[\triangle BKL=  \frac12 \cdot (\sqrt{13})^2\cdot(\frac{4}{4+\sqrt{13}})=\frac{104-26\sqrt{13}}{3}\]
So the answer is $104+26+13+3=\boxed{146}$

Answer:  146
Problem: Given a circle of radius $\sqrt{13}$ , let $A$ be a point at a distance $4 + \sqrt{13}$ from the center $O$ of the circle. Let $B$ be the point on the circle nearest to point $A$ . A line passing through the point $A$ intersects the circle at points $K$ and $L$ . The maximum possible area for $\triangle BKL$ can be written in the form $\frac{a - b\sqrt{c}}{d}$ , where $a$ $b$ $c$ , and $d$ are positive integers, $a$ and $d$ are relatively prime, and $c$ is not divisible by the square of any prime. Find $a+b+c+d$

Solution: Let $N,M$ les on $AL$ such that $BM\bot AL, ON\bot AL$ , call $BM=h, ON=k,LN=KN=d$ We call $\angle{LON}=\alpha$ By similar triangle, we have $\frac{h}{k}=\frac{4}{4+\sqrt{13}}, h=\frac{4k}{4+\sqrt{13}}$ . Then, we realize the area is just $dh=d\cdot \frac{4K}{4+\sqrt{13}}$ As $\sin \alpha=\frac{d}{\sqrt{13}}, \cos \alpha=\frac{k}{\sqrt{13}}$ . Now, we have to maximize $\frac{52\sin \alpha \cos \alpha}{4+\sqrt{13}}=\frac{26\sin 2\alpha}{4+\sqrt{13}}$ , which is obviously reached when $\alpha=45^{\circ}$ , the answer is $\frac{104-26\sqrt{13}}{3}$ leads to $\boxed{146}$

Answer:  146
Problem: Given a circle of radius $\sqrt{13}$ , let $A$ be a point at a distance $4 + \sqrt{13}$ from the center $O$ of the circle. Let $B$ be the point on the circle nearest to point $A$ . A line passing through the point $A$ intersects the circle at points $K$ and $L$ . The maximum possible area for $\triangle BKL$ can be written in the form $\frac{a - b\sqrt{c}}{d}$ , where $a$ $b$ $c$ , and $d$ are positive integers, $a$ and $d$ are relatively prime, and $c$ is not divisible by the square of any prime. Find $a+b+c+d$

Solution: Let C and D be the base of perpendiculars dropped from points O and B to AK.  Denote BD = h, OC = H. \[\triangle ABD \sim \triangle AOC \implies \frac {h}{H} = \frac {4}{4 + \sqrt{13}}.\] $KL$ is the base of  triangles $\triangle OKL$ and $\triangle BKL \implies \frac {[BKL]}{[OKL]} = \frac{h}{H} =$ const $\implies$ The maximum possible area for $\triangle BKL$ and $\triangle OKL$ are at the same position of point $K$
$\triangle OKL$ has sides $OK = OL = \sqrt{13}\implies \max[\triangle OKL] = \frac {OK^2}{2} = \frac {13}{2}$
in the case $\angle KOL = 90^\circ.$ It is possible – if we rotate such triangle, we can find position when $A$ lies on $KL.$ \[\max[\triangle BKL] = \max[\triangle OKL] \cdot \frac {4}{4+\sqrt{13}} = \frac {26}{4+\sqrt{13}} \implies \boxed{146}\] vladimir.shelomovskii@gmail.com, vvsss

Answer:  146
Problem: Let $A = \{1, 2, 3, 4, 5, 6, 7\}$ , and let $N$ be the number of functions $f$ from set $A$ to set $A$ such that $f(f(x))$ is a constant function. Find the remainder when $N$ is divided by $1000$

Solution: Any such function can be constructed by distributing the elements of $A$ on three tiers.
The bottom tier contains the constant value, $c=f(f(x))$ for any $x$ . (Obviously $f(c)=c$ .)
The middle tier contains $k$ elements $x\ne c$ such that $f(x)=c$ , where $1\le k\le 6$
The top tier contains $6-k$ elements such that $f(x)$ equals an element on the middle tier.
There are $7$ choices for $c$ . Then for a given $k$ , there are $\tbinom6k$ ways to choose the elements on the middle tier, and then $k^{6-k}$ ways to draw arrows down from elements on the top tier to elements on the middle tier.
Thus $N=7\cdot\sum_{k=1}^6\tbinom6k\cdot k^{6-k}=7399$ , giving the answer $\boxed{399}$

Answer:  399
Problem: Let $A = \{1, 2, 3, 4, 5, 6, 7\}$ , and let $N$ be the number of functions $f$ from set $A$ to set $A$ such that $f(f(x))$ is a constant function. Find the remainder when $N$ is divided by $1000$

Solution: Define the three layers as domain $x$ codomain $f(x)$ , and codomain $f(f(x))$ . Each one of them is contained in the set $A$ . We know that $f(f(x))$ is a constant function , or in other words, can only take on one value. So, we can start off by choosing that value $c$ in $7$ ways. So now, we choose the values that can be $f(x)$ for all those values should satisfy $f(f(x))=c$ . Let's $S$ be that set of values. First things first, we must have $c$ to be part of $S$ , for the $S$ is part of the domain of $x$ . Since the values in $i\in S$ all satisfy $f(i) = c$ , we have $c$ to be a value that $f(x)$ can be. Now, for the elements other than $5$
If we have $k$ elements other than $5$ that can be part of $S$ , we will have $\binom{6}{k}$ ways to choose those values. There will also be $k$ ways for each of the elements in $A$ other than $c$ and those in set $S$ (for when function $f$ is applied on those values, we already know it would be $c$ ). There are $6-k$ elements in $A$ other than $c$ and those in set $S$ . Thus, there should be $6^{6-k}$ ways to match the domain $x$ to the values of $f(x)$ . Summing up all possible values of $k$ $[1,6]$ ), we have
\[\sum_{k=1}^6 k^{6-k} = 6\cdot 1 + 15\cdot 16 + 20\cdot 27 + 15\cdot 16 + 6\cdot 5 + 1) = 1057\]
Multiplying that by the original $7$ for the choice of $c$ , we have $7 \cdot 1057 = 7\boxed{399}.$

Answer:  399
Problem: Let $S$ be the set of all polynomials of the form $z^3 + az^2 + bz + c$ , where $a$ $b$ , and $c$ are integers. Find the number of polynomials in $S$ such that each of its roots $z$ satisfies either $|z| = 20$ or $|z| = 13$

Solution: Every cubic with real coefficients has to have either three real roots or one real and two nonreal roots which are conjugates. This follows from Vieta's formulas
The real root $r$ must be one of $-20$ $20$ $-13$ , or $13$ . By Viète's formulas, $a=-(r+\omega+\omega^*)$ $b=|\omega|^2+r(\omega+\omega^*)$ , and $c=-r|\omega|^2$ . But $\omega+\omega^*=2\Re{(\omega)}$ (i.e., adding the conjugates cancels the imaginary part). Therefore, to make $a$ an integer, $2\Re{(\omega)}$ must be an integer. Conversely, if $\omega+\omega^*=2\Re{(\omega)}$ is an integer, then $a,b,$ and $c$ are clearly integers. Therefore $2\Re{(\omega)}\in \mathbb{Z}$ is equivalent to the desired property. Let $\omega=\alpha+i\beta$
In this case, $\omega$ lies on a circle of radius $20$ in the complex plane. As $\omega$ is nonreal, we see that $\beta\ne 0$ .  Hence $-20<\Re{(\omega)}< 20$ , or rather $-40<2\Re{(\omega)}< 40$ . We count $79$ integers in this interval, each of which corresponds to a unique complex number on the circle of radius $20$ with positive imaginary part.
In this case, $\omega$ lies on a circle of radius $13$ in the complex plane. As $\omega$ is nonreal, we see that $\beta\ne 0$ .  Hence $-13<\Re{(\omega)}< 13$ , or rather $-26<2\Re{(\omega)}< 26$ . We count $51$ integers in this interval, each of which corresponds to a unique complex number on the circle of radius $13$ with positive imaginary part.
Therefore, there are $79+51=130$ choices for $\omega$ . We also have $4$ choices for $r$ , hence there are $4\cdot 130=520$ total polynomials in this case.
In this case, there are four possible real roots, namely $\pm 13, \pm20$ . Let $p$ be the number of times that $13$ appears among $r_1,r_2,r_3$ , and define $q,r,s$ similarly for $-13,20$ , and $-20$ , respectively. Then $p+q+r+s=3$ because there are three roots. We wish to find the number of ways to choose nonnegative integers $p,q,r,s$ that satisfy that equation. By balls and urns, these can be chosen in $\binom{6}{3}=20$ ways.
Therefore, there are a total of $520+20=\boxed{540}$ polynomials with the desired property.

Answer:  540
Problem: Let $S$ be the set of all polynomials of the form $z^3 + az^2 + bz + c$ , where $a$ $b$ , and $c$ are integers. Find the number of polynomials in $S$ such that each of its roots $z$ satisfies either $|z| = 20$ or $|z| = 13$

Solution: There are two cases: either all the roots are real, or one is real and two are imaginary.
Case 1: All roots are real.
Then each of the roots is a member of the set $\{-20, 20, -13, 13\}$ . It splits into three sub-cases: either no two are the same, exactly two are the same, or all three are the same.
Sub-case 1.1: No two are the same.
This is obviously $\dbinom{4}{3}=4$
Sub-case 1.2: Exactly two are the same.
There are four ways to choose the root that will repeat twice, and three ways to choose the remaining root. For this sub-case, $4\cdot 3=12$
Sub-case 1.3: All three are the same.
This is obviously $4$
Thus for case one, we have $4+12+4=20$ polynomials in $S$ . We now have case two, which we state below.
Case 2: Two roots are imaginary and one is real.
Let these roots be $p-qi$ $p+qi$ , and $r$ . Then by Vieta's formulas
Since $a$ $b$ $c$ , and $r$ are integers, we have that $p=\frac{1}{2}k$ for some integer $k$ . Case two splits into two sub-cases now:
Sub-case 2.1: $|p-qi|=|p+qi|=13$ .
Obviously, $|p|<13$ . The $51$ cases in which $p$ is either $0,\pm\frac{1}{2},\pm\frac{2}{2},\pm\frac{3}{2},\ldots,\pm\frac{25}{2}$ are acceptable. Each can pair with one value of $q$ and four values of $r$ , adding $51\cdot 4=204$ polynomials to $S$
Sub-case 2.2: $|p-qi|=|p+qi|=20$ .
Obviously, $|p|<20$ . Here, the $79$ cases in which $p$ is either $0,\pm\frac{1}{2},\pm\frac{2}{2},\pm\frac{3}{2},\ldots,\pm\frac{39}{2}$ are acceptable. Again, each can pair with a single value of $q$ as well as four values of $r$ , adding $79\cdot 4=316$ polynomials to $S$
Thus for case two, $204+316=520$ polynomials are part of $S$
All in all, $20+204+316=\boxed{540}$ polynomials can call $S$ home.

Answer:  540
Problem: For positive integers $n$ and $k$ , let $f(n, k)$ be the remainder when $n$ is divided by $k$ , and for $n > 1$ let $F(n) = \max_{\substack{1\le k\le \frac{n}{2}}} f(n, k)$ . Find the remainder when $\sum\limits_{n=20}^{100} F(n)$ is divided by $1000$

Solution: We can find that
$20\equiv 6 \pmod{7}$
$21\equiv 5 \pmod{8}$
$22\equiv 6 \pmod{8}$
$23\equiv 7 \pmod{8}$
$24\equiv 6 \pmod{9}$
$25\equiv 7 \pmod{9}$
$26\equiv 8 \pmod{9}$
Observing these and we can find that the reminders are in groups of three continuous integers, considering this is true, and we get
$99\equiv 31 \pmod{34}$
$100\equiv 32 \pmod{34}$
So the sum is $6+3\times(6+...+31)+31+32=1512$ ,it is also 17+20+23+...+95, so the answer is $\boxed{512}$ .
By: Kris17

Answer:  512
Problem: For positive integers $n$ and $k$ , let $f(n, k)$ be the remainder when $n$ is divided by $k$ , and for $n > 1$ let $F(n) = \max_{\substack{1\le k\le \frac{n}{2}}} f(n, k)$ . Find the remainder when $\sum\limits_{n=20}^{100} F(n)$ is divided by $1000$

Solution: $Lemma:$ Highest remainder when $n$ is divided by $1\leq k\leq n/2$ is obtained for $k_0 = (n + (3 - n \pmod{3}))/3$ and the remainder thus obtained is $(n - k_0*2) = [(n - 6)/3 + (2/3)*n \pmod{3}]$
$Note:$ This is the second highest remainder when $n$ is divided by $1\leq k\leq n$ and the highest remainder occurs when $n$ is divided by $k_M$ $(n+1)/2$ for odd $n$ and $k_M$ $(n+2)/2$ for even $n$
Using the lemma above:
$\sum\limits_{n=20}^{100} F(n) = \sum\limits_{n=20}^{100} [(n - 6)/3 + (2/3)*n \pmod{3}]$ $= [(120*81/2)/3 - 2*81 + (2/3)*81] = 1512$
So the answer is $\boxed{512}$

Answer:  512
Problem: Let $A,B,C$ be angles of a triangle with \begin{align*} \cos^2 A + \cos^2 B + 2 \sin A \sin B \cos C &= \frac{15}{8} \text{ and} \\ \cos^2 B + \cos^2 C + 2 \sin B \sin C \cos A &= \frac{14}{9} \end{align*} There are positive integers $p$ $q$ $r$ , and $s$ for which \[\cos^2 C + \cos^2 A + 2 \sin C \sin A \cos B = \frac{p-q\sqrt{r}}{s},\] where $p+q$ and $s$ are relatively prime and $r$ is not divisible by the square of any prime.  Find $p+q+r+s$

Solution: Let's draw the triangle. Since the problem only deals with angles, we can go ahead and set one of the sides to a convenient value. Let $BC = \sin{A}$
By the Law of Sines, we must have $CA = \sin{B}$ and $AB = \sin{C}$
Now let us analyze the given:
\begin{align*} \cos^2A + \cos^2B + 2\sin A\sin B\cos C &= 1-\sin^2A + 1-\sin^2B + 2\sin A\sin B\cos C \\ &= 2-(\sin^2A + \sin^2B - 2\sin A\sin B\cos C) \end{align*}
Now we can use the Law of Cosines to simplify this:
\[= 2-\sin^2C\]
Therefore: \[\sin C = \sqrt{\dfrac{1}{8}},\cos C = \sqrt{\dfrac{7}{8}}.\] Similarly, \[\sin A = \sqrt{\dfrac{4}{9}},\cos A = \sqrt{\dfrac{5}{9}}.\] Note that the desired value is equivalent to $2-\sin^2B$ , which is $2-\sin^2(A+C)$ . All that remains is to use the sine addition formula and, after a few minor computations, we obtain a result of $\dfrac{111-4\sqrt{35}}{72}$ . Thus, the answer is $111+4+35+72 = \boxed{222}$

Answer:  222