##################################
#                                #
# Last modified 2025/07/25       # 
#                                #
# Georgi Marinov                 #
#                                # 
##################################

import sys
import string
import os
import gzip
import subprocess
import regex

def run():

    if len(sys.argv) < 2:
        print 'usage: python %s fasta Q' % sys.argv[0]
        print '\tUse - instead of a fastq name if you want to capture standard input'
        print '\tthe script can read gzipped files directly'
        print '\tthe script will print to standard output by default'
        sys.exit(1)

    fastq = sys.argv[1]
    Q = sys.argv[2]

    if fastq == '-':
        lineslist  = sys.stdin
    elif fastq.endswith('.gz'):
        lineslist  = gzip.open(fastq)
    else:
        lineslist  = open(fastq)
    i=1
    for line in lineslist:
        if i == 1 and line[0]!='>':
            print 'fasta file broken, exiting'
            sys.argv(1)
        if i == 1 and line[0]=='>':
            readID = '@' + line.strip()[1:]
            print readID
            i=2
            continue
        if i == 2:
            sequence = line.strip()
            print sequence
            print '+'
            print len(sequence)*Q
            i=1
            continue

run()

