First we should know what is the necessary substances and then the entry point of each one.
The necessary substances are: water and minerals - carbon dioxide (CO2) - light energy
The entry point and the process: By taking in water (H2O) through the roots, carbon dioxide (CO2) from the air, and light energy from the Sun, plants can perform photosynthesis to make glucose (sugars) and oxygen (O2).

The formula for photosynthesis:
6CO2 + 6H2O + Light energy → C6H12O6 (sugar) + 6O2