Ram and Shyam, two magicians, present a magic-show together. Ram triples every red flower in 10 seconds and Ravi doubles every yellow flower in 10 seconds. If after a minute there were 1049 red and yellow flowers, how many flowers were there initially?