---
category_name: hard
problem_code: PLUSEQ
problem_name: 'Plus Equation'
languages_supported:
- C
- CPP14
- JAVA
- PYTH
- 'PYTH 3.5'
- PYPY
- CS2
- 'PAS fpc'
- 'PAS gpc'
- RUBY
- PHP
- GO
- NODEJS
- HASK
- rust
- SCALA
- swift
- D
- PERL
- FORT
- WSPC
- ADA
- CAML
- ICK
- BF
- ASM
- CLPS
- PRLG
- ICON
- 'SCM qobi'
- PIKE
- ST
- NICE
- LUA
- BASH
- NEM
- 'LISP sbcl'
- 'LISP clisp'
- 'SCM guile'
- JS
- ERL
- TCL
- kotlin
- PERL6
- TEXT
- 'SCM chicken'
- CLOJ
- COB
- FS
max_timelimit: '5'
source_sizelimit: '50000'
problem_author: iloveksh
problem_tester: mgch
date_added: 20-05-2018
tags:
- iloveksh
time:
view_start_date: 1528709405
submit_start_date: 1528709405
visible_start_date: 1528709405
end_date: 1735669800
current: 1528985564
is_direct_submittable: false
layout: problem
---
All submissions for this problem are available.### Read problems statements in [Mandarin chinese](http://www.codechef.com/download/translated/JUNE18/mandarin/PLUSEQ.pdf), [Russian](http://www.codechef.com/download/translated/JUNE18/russian/PLUSEQ.pdf) and [Vietnamese](http://www.codechef.com/download/translated/JUNE18/vietnamese/PLUSEQ.pdf) as well.
You are given a string $S$ containing only decimal digits ('0' through '9') and a number $N$. Your task is to insert an arbitrary number (including zero) of plus signs '+' into $S$ in order to form a valid expression whose value is equal to $N$. ### Input - The first line of the input contains a single integer $T$ denoting the number of test cases. The description of $T$ test cases follows. - The first and only line of each test case contains a string $S$, followed by a space and an integer $N$. ### Output For each test case, print a single line containing one string — your solution, i.e. the expression obtained after inserting some plus signs into $S$. If there are multiple solutions, you may output any one. It is guaranteed that at least one solution exists. ### Constraints - $T \\le 5$ - $1 \\le |S| \\le 120$ - $N