Problem

9 /11


For what is the smallest x?

Theory Click to read/hide

Python
You can enter an integer from the keyboard like this: n = int(input()) # entered a string and converted it to a number input() - enter a string,
int(x) is a function that converts x to a number.

Problem

The value of the expression \( 27^7 - 3^{11} + 36 - x\) was written in the ternary number system, while the sum of the digits in the record turned out to be equal to b (entered from the keyboard, 0 < b < 100).  Write a program that displays the minimum natural value of x. The answer is guaranteed to exist.