var collection = File.ReadLines("/var/data/data.txt");

if (!collection.Any())
{
    throw new ArgumentException("Incorrect file");
}

if (!int.TryParse(collection.First(), out int firstNumber))
{
    throw new ArgumentException("Wrong number");
}

if (!int.TryParse(collection.Last(), out int lastNumber))
{
    throw new ArgumentException("Wrong number");
}

var result = lastNumber * firstNumber;

File.WriteAllText("/var/result/result.txt", result.ToString());